[bzoj4424] Fairy

Source: Internet
Author: User

I wanted to write this question a long time ago. The result still can't grasp CF of E, too god ah ...

The first consideration is the nature of the binary graph, the so easy, there is no odd ring in the graph.

Then consider it in three different situations:

1. There is only one odd ring, delete whichever one

2. Multiple odd rings, remove the one they all cover

3. There is no odd ring, it is not a cool blow.

Then also introduced the "atavistic edge" concept, this specific can see the blog http://blog.csdn.net/DaD3zZ/article/details/50879626 too god, I'm not at all.

Which is a detailed description of the deletion, how to delete the question, similar to a prefix and the idea of each atavistic the edge of a mark.

1. If it is a atavistic edge, and on the only singular ring, then you can delete

2 If it is an odd ring edge in the tree and is covered by all the odd rings, and is not covered by a pair of rings, you can also delete

The most important thing is the DP process: Odd[i] represents the parent benchion ring of I, and even represents the even ring

voidWorkintu) {Flag[u]=1;intE=Head[u];  while(e>0)  {    intv=Vet[e]; if(Ont[(e+1)/2]&&flag[v]==0) {work (v); Odd[u]+=odd[v];even[u]+=Even[v]; road[(e+1)/2].o=odd[v];road[(e+1)/2].e=Even[v]; } e=Next[e]; }}
Work

[bzoj4424] Fairy

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.