zoj 3659 Conquer a New Region】的更多相关文章

Conquer a New Region Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 657 Accepted Submission(s): 179 Problem Description The wheel of the history rolling forward, our king conquered a new region i…
Conquer a New Region Time Limit: 5 Seconds      Memory Limit: 32768 KB The wheel of the history rolling forward, our king conquered a new region in a distant continent. There are N towns (numbered from 1 to N) in this region connected by several road…
// 给你一颗树 选一个点,从这个点出发到其它所有点的权值和最大// i 到 j的最大权值为 i到j所经历的树边容量的最小值// 第一感觉是树上的dp// 后面发现不可以// 看了题解说是并查集// 然后发现这不就是在最小生成树那个模板上做其它操作吗..// 的确是好题#include <iostream> #include <algorithm> #include <stdio.h> #include <cmath> #include <string…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4882 代码: #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<vector> using namespace std; ; struct Edge { int u,v,w; Edge(,,): u(u…
并检查集合 侧降序,每增加一个侧面应该推断,其中基本建设方..... Conquer a New Region Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1169    Accepted Submission(s): 373 Problem Description The wheel of the history rolling…
Conquer a New Region Time Limit: 5 Seconds      Memory Limit: 32768 KB The wheel of the history rolling forward, our king conquered a new region in a distant continent. There are N towns (numbered from 1 to N) in this region connected by several road…
这题要用到一点贪心的思想,因为一个点到另一个点的运载能力决定于其间的边的最小权值,所以先把线段按权值从大到小排个序,每次加的边都比以前小,然后合并集合时,比较 x = findset(a) 做根或 y = findset(b) 做根时,总权值的大小,x做根的总权值 ca = num[b]*w + cap[a] ,b同理.即b这个集合的点个数乘以新加的边的距离为新增的权值.然后合并.. 代码: #include <iostream> #include <cstdio> #includ…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3659 #include<cstdio> #include<iostream> #include<cstring> #include<vector> #include<algorithm> using namespace std; ; int p[maxn],num[maxn]; long long int sum…
The wheel of the history rolling forward, our king conquered a new region in a distant continent.There are N towns (numbered from 1 to N) in this region connected by several roads. It's confirmed that there is exact one route between any two towns. T…
http://acm.hdu.edu.cn/showproblem.php?pid=4424 [题目大意] 给你N个点和N-1条边的连通图,也就是说任意两点间的路径是唯一的.每条边有个权值,从一点到另一点的最大流量是路径中所有边中权值的最小值.要你找一个点,使得这点到剩下所有点的最大流量之和最大,求这个最大流量和. [分析1:动态规划 ] 假设现在有两个点的集合S1和S2,添加的一条边可以使得这两个集合连通起来,要求最大的流量之和,那么只有两种情况:1.选取的中心点在S1中:2.选取的中心点在S…