P4047 [JSOI2010]部落划分
2021-03-13 23:31
阅读:538
标签:pre sort 结构体 ios size stream struct span 生成
算法
最小生成树
思路
我们把每个点看成一个部落,每次取最小距离的两个抱团,同时部落也减少了一个....然后减减减,直到部落数==目标数,此时下一个不同部落的距离就是最短的距离!
代码
#include#include #include #include #include const int MA = 1e7; using namespace std; int o,n,k,num,flag; int fa[MA]; inline int read() { int x = 0; char c = getchar(); while (!isdigit(c))c = getchar(); while(c>=‘0‘&&c
P4047 [JSOI2010]部落划分
标签:pre sort 结构体 ios size stream struct span 生成
原文地址:https://www.cnblogs.com/ruanmowen/p/12813978.html
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:P4047 [JSOI2010]部落划分
文章链接:http://soscw.com/index.php/essay/64326.html
文章标题:P4047 [JSOI2010]部落划分
文章链接:http://soscw.com/index.php/essay/64326.html
评论
亲,登录后才可以留言!