随笔分类 - 图论-最小&次小&k小生成树
摘要:Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whe
阅读全文
摘要:You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write
阅读全文
摘要:Farmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the area. He needs you
阅读全文
摘要:The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22668 Accepted: 8038 Description Given a connected undirected graph, tell if
阅读全文
摘要:还是畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 53939 Accepted Submission(s): 24482 Proble
阅读全文
摘要:#include #include #include using namespace std; int fat[5001]; int tot; struct node{ int x,y,z;//结构体保存起点x,终点y,以及边权z }f[200001]; int find(int x)//路径压缩 { if(fat[x] != x) fat[x] = f...
阅读全文
摘要:题目描述 如题,给出一个无向图,求出最小生成树,如果该图不连通,则输出orz 输入输出格式 输入格式: 第一行包含两个整数N、M,表示该图共有N个结点和M条无向边。(N<=5000,M<=200000) 接下来M行每行包含三个整数Xi、Yi、Zi,表示有一条长度为Zi的无向边连接结点Xi、Yi 输出
阅读全文
摘要:定义: 在一个连通图G中,如果取它的全部顶点和一部分边构成一个子图G’ , 即: V( G ' ) = V( G ); E( G ')∈E( G ); 若边集E( G ')中的边既将图中的所有顶点联通又不形成回路(回路:首尾节点相同),则称子图G'是原图G的一颗生成树。 一颗含有n个点的生成树,必含
阅读全文