题目链接 Problem Description The Gorelians are a warlike race that travel the universe conquering new worlds as a form of recreation. Given their violent, fun-loving nature, keeping their leaders alive is of serious concern. Part of the Gorelian security…
题目链接: PKU:http://poj.org/problem? id=3653 ZJU:problemId=1934" target="_blank">http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1934 HDU:http://acm.hdu.edu.cn/showproblem.php? pid=2722 Description The Gorelians are a warlike rac…
Here We Go(relians) Again Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 1   Accepted Submission(s) : 1 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description The Gorelians…
Here We Go(relians) Again Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 685    Accepted Submission(s): 335 Problem Description The Gorelians are a warlike race that travel the universe conquer…
最短路,建图太麻烦,略过…… #include <cstdio> #include <cstring> #include <queue> const int INF=9999999; using namespace std; struct node{ int v,i; node(int a,int b){v=a,i=b;} bool operator <(const node& a)const{return v>a.v;} }; int n,m,ma…
根据矩阵建图,然后求最短路径. #include <cstdio> #include <cstring> #include <cstdlib> #define L 2520 #define MAXN 600 #define INF 0x2f2f2f2f int map[MAXN][MAXN]; int dis[MAXN]; int path[MAXN]; int vn; bool visit[MAXN]; void dijkstra() { int i, j, v, m…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5545 题意:有N个村庄, M 个战场: $ 1 <=N,M <= 10^5 $; 其中曹操会从第i个村庄中选出若个人 在x[i]战场为其作战, 同时第i个村庄也会有相同的人数在y[i]战场为袁绍作战: 每个战场i 有对应的重要度w[i],w[i]的值为 0,1,2: w[i]为2的战场,要求曹操的兵数(从村庄得到的) 严格大于 袁绍的兵的数量: w[i]为1的战场,曹操的兵数不少于袁绍的兵即可:…
Marriage Match IV 题目链接: http://acm.hust.edu.cn/vjudge/contest/122685#problem/Q Description Do not sincere non-interference. Like that show, now starvae also take part in a show, but it take place between city A and B. Starvae is in city A and girls a…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2586 最近公共祖先问题~~LAC离散算法 题目大意:一个村子里有n个房子,这n个房子用n-1条路连接起来,接下了有m次询问,每次询问两个房子a,b之间的距离是多少. 很明显的最近公共祖先问题,先建一棵树,然后求出每一点i到树根的距离dis[i],然后每次询问a,b之间的距离=dis[a]+dis[b]-2*dis[LCA(a,b)]; LCA(a,b)即是a,b的最近公共祖先.. 关于最近公共祖先,…
Lazy Running Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1384    Accepted Submission(s): 597 Problem Description In HDU, you have to run along the campus for 24 times, or you will fail in…