[BZOJ1854] [Scoi2010] Game (binary map matching/and check set)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.