Conquer a New Region Time Limit: 5 Seconds      Memory Limit: 32768 KB The wheel of the history rolling forward, our king conquered a new region in a distant continent. There are N towns (numbered from 1 to N) in this region connected by several road…
Conquer a New Region Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 657 Accepted Submission(s): 179 Problem Description The wheel of the history rolling forward, our king conquered a new region i…
HDU 4291 A Short problem(2012 ACM/ICPC Asia Regional Chengdu Online) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=4291 Description 给一个式子求结果.类似Fibonacci的公式g(n)=3*g(n-1)+g[n-2]. Input 给你n(1<=n<=1e18) Output 求g(g(g(n))) Sample Input 样例第一个就是0什么鬼,虽然没影响.…
// 给你一颗树 选一个点,从这个点出发到其它所有点的权值和最大// i 到 j的最大权值为 i到j所经历的树边容量的最小值// 第一感觉是树上的dp// 后面发现不可以// 看了题解说是并查集// 然后发现这不就是在最小生成树那个模板上做其它操作吗..// 的确是好题#include <iostream> #include <algorithm> #include <stdio.h> #include <cmath> #include <string…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4882 代码: #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<vector> using namespace std; ; struct Edge { int u,v,w; Edge(,,): u(u…
题意:一棵树上有m个红色结点,树的边有权值.q次查询,每次给出k个点,每次查询有且只有一次机会将n个点中任意一个点染红,令k个点中距离红色祖先距离最大的那个点的距离最小化.q次查询相互独立. 分析:数据量很... 最大值最小化,二分搜答案.将ST表求lca的dfs函数加一点东西,求出每个点到其最近红色祖先的距离.check函数中,枚举到其红色祖先的距离超过下限的点.设非法点数为p,尝试将其距离通过一次染色缩小.具体做法是求出这p个点的lca,这个点就是要染红的点,因为只有修改这个点,才有可能将所…
2016 ACM ICPC Asia Region - Tehran A - Tax 题目描述:算税. solution 模拟. B - Key Maker 题目描述:给出\(n\)个序列,给定一个序列,问\(n\)个序列中有多少个序列满足对应位的值小于或等于给定序列的值. solution 模拟. C - IOI 2017 Logo 题目描述:有\(m\)件作品,\(n\)个人投票,每个人可以选三件作品,分别给\(1, 2, 3\)分,每件作品按总分排序,总分相同按得\(3\)分的数量排序,还…
Sum of divisors Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4318    Accepted Submission(s): 1382 Problem Description mmm is learning division, she's so proud of herself that she can figure…
Dr. X is a biologist, who likes rabbits very much and can do everything for them. 2012 is coming, and Dr. X wants to take some rabbits to Noah's Ark, or there are no rabbits any more. A rabbit's genes can be expressed as a string whose length is l (1…
Problem Description In this problem, you are given several strings that contain only digits from '0' to '9', inclusive.An example is shown below.101123The set S of strings is consists of the N strings given in the input file, and all the possible sub…