Genealogical tree Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submission(s) : 5   Accepted Submission(s) : 3 Special Judge Problem Description The system of Martians' blood relations is confusing enough. Ac…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1535 Problem Description In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all,…
把我坑到死的题 开始开题以为是全图连通是的最小值 ,以为是最小生成树,然后敲了发现不是,看了下别人的题意,然后懂了: 然后发现数据大,要用邻接表就去学了一下邻接表,然后又去学了下优先队列优化的dij: 这坑爹的题目我交了10几遍,也不知道错在哪里:后来知道了maxint要#define Maxint 10000000000: 然后long int 是过不了的,改成long long才能过 ,真是呵呵啊: #include<stdio.h> #include<string.h> #i…
Problem 1037: Wormhole Time Limits:  5000 MS   Memory Limits:  200000 KB 64-bit interger IO format:  %lld   Java class name:  Main Description With our time on Earth coming to an end, Cooper and Amelia have volunteered to under- take what could be th…
#include <iostream> #include <cmath> #include <cstring> #include <cstdlib> #include <cstdio> #include <algorithm> #include <vector> #include <queue> using namespace std; #define INF 0xfffffff #define maxn 10…
Reward Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 7   Accepted Submission(s) : 3 Problem Description Dandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to…
最短路 Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 81706    Accepted Submission(s): 35385 Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt.但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最…
确定比赛名次 Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 40   Accepted Submission(s) : 31 Problem Description 有N个比赛队(1<=N<=500),编号依次为1,2,3,....,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的…
首先说下STL优先队列的局限性,那就是只提供入队.出队.取得队首元素的值的功能,而dijkstra算法的堆优化需要能够随机访问队列中某个节点(来更新源点节点的最短距离). 看似可以用vector配合make_heap/push_heap/pop_heap来实现这个功能,实际上手动实现就会发现问题所在.比如在dist[v] > dist[u] + cost(u,v)时,需要更新dist[v],然后重新确定v在vector的位置,需要使用push_heap,这样问题就出现了. v又在vector的哪…
题目地址:https://pta.patest.cn/pta/test/558/exam/4/question/9495 由于边数E<(n*(n-1))/2 所以我选用了邻接表实现,优先队列用循环队列实现: DFS基本思路: 1:选择一个点,标志已经访问过: 2:判断这个点的其他邻接点(访问顺序按题目是从小到大)是否访问过,来选择下一个点: 3:重复第2点直到全部点已经访问过. 伪代码如下 DFS( Vertex v ) { Visit( V ); Visited[V] = true; fore…