Desert King Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 25310 Accepted: 7022 Description David the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his coun…
Desert King Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 21766 Accepted: 6087 Description David the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his coun…
http://poj.org/problem?id=2728 Desert King Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 18595 Accepted: 5245 Description David the Great has just become the king of a desert country. To win the respect of his people, he decided to b…
Desert King Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 22717 Accepted: 6374 Description David the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his coun…
题目大意:给定一个 N 个点的无向完全图,边有两个不同性质的边权,求该无向图的一棵最优比例生成树,使得性质为 A 的边权和比性质为 B 的边权和最小. 题解:要求的答案可以看成是 0-1 分数规划问题,即:选定一个数 mid,每次重新构建边权为 \(a[i]-mid*b[i]\) 的图,再在图上跑一遍最小生成树(这里由于是完全图,应该采用 Prim 算法)判断最小值和给定判定的最小值的关系即可,这里为:若最小值大于 mid,则下界提高,否则上界下降. 代码如下 #include<cmath>…