题意: 有许多油井和村庄什么的,让你使得这些村庄能连通一个油井就好了.第一行给你一个数字T代表有T组测试数据,第二行有 M , N , K ,M代表包括油井在内的村庄数,N 代表有N个 两两连通的地方.K代表有K个油井.接下来有N行,每行三个数 u , v, w, 代表 u 号和 v 是连通的 权值为 w. 思路: 以往做的题目都是只有一个源点,这道题油井的数目就是源点,所以源点不唯一.但是不要想复杂啦.其实一开始直接让所有源点并在一.再求最小生成树就好了. 代码: import java.ut…
D - Nanami's Power Plant 思路:类似与bzoj切糕那道题的模型.. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int> #defin…
There are N (1 ≤ N ≤ 105) cities on land, and there are N - 1 wires connecting the cities. Therefore, each city can transmit electricity to all other cities by these wires. Dark_Sun made a decision to build a nuclear power plant to supply electricity…
The Department of National Defence(DND)wishestoconnectseveral northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: every outpost will have a radio transceiver and some outposts…