CF1039D You Are Given a Tree 容易发现,当 \(k\) 不断增大时,答案不断减小,且 \(k\) 的答案不超过 \(\lfloor\frac {n}{k}\rfloor\) ,因此不同的答案个数是 \(\sqrt n\) 级别的,可以用一种类似整体二分的方式求解. 对于一个 \(k\) ,从叶子节点贪心向上匹配即可得到答案. 点击查看代码 #include<bits/stdc++.h> using namespace std; int n; int ver[2000…
Choosing Capital for Treeland Description The country Treeland consists of n cities, some pairs of them are connected with unidirectional roads. Overall there are n - 1 roads in the country. We know that if we don't take the direction of the roads in…
Cowcycles题解 Originally by Don Gillies [International readers should note that some words are puns on cows.] Having made a fortune on Playbov magazine, Hugh Heifer has moved from his original field in the country to a fashionable yard in the suburbs.…