摘要: http://ac.jobdu.com/problem.php?id=1347第一次做时间这么严格的题目1.DFS超时2.并查集判断是否连通,prim求最小生成树,超时3.并查集判断是否连通,Kruskal求最小生成树,超时4.并查集+路径压缩判断是否连通,Kruskal求最小生成树,AC 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <queue> 5 #include <algorithm> 6 using namespace 阅读全文
posted @ 2011-12-11 21:50 linyvxiang 阅读(207) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1346 1 #include <stdio.h> 2 #include <algorithm> 3 using namespace std; 4 struct Cus{ 5 int id,s; 6 }; 7 8 struct Cus cu[1002]; 9 bool cmp(struct Cus a,struct Cus b)10 {11 if(a.s!=b.s)12 return a.s>b.s;13 return a.id<b.id;14 }15 int min(int a,... 阅读全文
posted @ 2011-12-11 10:31 linyvxiang 阅读(197) 评论(0) 推荐(0) 编辑