Title: http://www.lydsy.com:808/JudgeOnline/problem.php?id=1854
Analysis: Very naked a two-figure match right, but in Hzwer's blog to see the magic and check set practice!
In fact, this problem and bzoj1191 amazing similarity!
Take the weight as a point, equipment as a side, since a device can only choose a property, that is, you want to be directed to the side, the arrow points to the point that you choose the properties of this equipment.
And then it's like bzoj1191.
If a point in a collection is a tree, it is clear that the point with the largest weight is the root, except for the point of the root node, if there is a ring in the set, then all the nodes in the set can be selected
Let's get one and look at the set.
Assume read-in Edge (x, y)
If find (x) ==find (y), then find (x) can be selected, P[find (x)]=1
If find (x)!=find (y), merge them, because more than one edge, the weight of the small root can also be selected! P[min (Find (x), find (y))]=1
The final result of the words, sweep from 1 to see if it can be said, know where to break, the output there
[BZOJ1854] [Scoi2010] Game (binary map matching/and check set)