[hdu5215] Non-map to find parity ring

Source: Internet
Author: User

Test instructions: such as title

Ideas: For the odd ring, a two-point chart to determine the OK, there are odd ring <=> non-dichotomy. For the even ring, consider that the ring must appear in the double-unicom component, you can first find the two components of the graph, for a dual-link component, for a double-unicom component inside each ring, if it is even ring, then even the ring has been found, otherwise assuming that there are more than one odd ring, you can choose two odd ring, the shared , even rings exist in this case. So there is no even ring situation can only be a double-link component is a large singular ring, characterized by: the number of edges = points, and is odd. So first DFS mark all the bridges, with and check set mark all the dual-link components, for each of the double Unicom components, calculate its points, for each edge, if its two endpoints belong to the same double unicom component, then the number of double-unicom component Edge +1. Because there is no edge, each edge is considered two times. For each double Unicom component, the condition is changed! ((cnt_v*2=cnt_e) &1), if true, indicates the existence of a even ring.

View Code

[hdu5215] Non-map to find parity ring

Related Article

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.