摘要:
1 =============================以下是最小生成树+并查集====================================== 2 【HDU】 3 1213 How Many Tables 基础并查集★ 4 1272 小希的迷宫 基础并查集★ 5 1325&&poj1308 Is It A Tree? 基础并查集★ 6 1856 More is better 基础并查集★ 7 1102 ... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1102 1 #include 2 #include 3 #define INF 1001 4 int map[101][101],vis[101],dist[101]; 5 int n; 6 int prim() 7 { 8 int i,j,mincost=0; 9 for(i=1;imap[p][j])28 dist[j]=map[p][j];29 }30 }31 return mincost;32 }33 int main()... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1863#include#include#includeusing namespace std;int f[105];typedef struct{ int x,y,w;}Edge;Edge edge[5000];int find(int x){ if(f[x]!=x) f[x]=find(f[x]); return f[x];}int cmp(Edge a,Edge b){ return a.w1) printf("?\n"); els... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1596 1 Problem : 1596 ( find the safest road ) Judge Status : Accepted 2 RunId : 10374805 Language : C++ Author : l1285556798 3 Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta 4 5 #include 6 #include 7 #define maxn 1001 8 d... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1599 1 Problem : 1599 ( find the mincost route ) Judge Status : Accepted 2 RunId : 10374468 Language : C++ Author : l1285556798 3 Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta 4 5 #include 6 #define INF 0xffffff 7 int map... 阅读全文