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