POJ 3723 Conscription(最大权森林问题)

“ Ctrl AC!一起 AC!”
题目:

 
分析:
将每个人看成点,关系看成边,我们将其构成的森林取最大的无环的边就是答案
若将边权取反,就相当于求最小生成树
代码
#include
using namespace std;
const int maxn=1e6+9;
const int mod=1e8+7;
int father[50005];
int n,m,r;
struct node{
int u,v,cost;
}edge[50005];
int cmp(struct node a,struct node b){
return a.cost

POJ 3723 Conscription(最大权森林问题)最先出现在Python成神之路

版权声明:
作者:玉兰
链接:https://www.techfm.club/p/27637.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>