【CodeChef PARITREE】[MARCH16] Parity tree

相关链接

题目传送门:https://www.codechef.com/MARCH16/problems/PARITREE
神犇题解:http://r64.is-programmer.com/posts/197030.html

解题报告

这题大概是PA2014 Kuglarz的升级版
我们发现其给定树上一条路径的奇偶性,实际上可以理解为给定路径上两个端点到根的路径的奇偶性的关系
换一句话来说,这两个的奇偶性定了一个,另一个也就确定了

所以给定$u,v$的奇偶性,就用并查集把这两货连一起
最后假设有$k$个连通块,那答案就是$2^k$
当然我们还需要特判一下无解的情况,在并查集那里多记录一点东西就可以了

14 thoughts to “【CodeChef PARITREE】[MARCH16] Parity tree”

  1. 338170 799372Thank you pertaining to giving this exceptional content on your web-site. I discovered it on google. I might check back once more in the event you publish extra aricles. 184297

  2. 53357 101928 Nice post. I learn something far more challenging on different blogs everyday. It will always be stimulating to read content material from other writers and practice a little something from their store. Id prefer to use some with the content material on my weblog whether you dont mind. Natually Ill give you a link on your web weblog. Thanks for sharing. 829490

  3. 947407 867058I just couldnt depart your website prior to suggesting that I really enjoyed the standard info an individual supply for your visitors? Is gonna be back often so that you can inspect new posts 593163

  4. 409900 629370It was any exhilaration discovering your internet site yesterday. I arrived here nowadays hunting new items. I was not necessarily frustrated. Your concepts following new approaches on this thing have been helpful plus an superb assistance to personally. We appreciate you leaving out time to write out these items and then for revealing your thoughts. 148210

  5. 681784 384712I was searching at some of your weblog posts on this internet site and I believe this web website is real instructive! Keep posting . 302504

  6. 911834 721783The electronic cigarette uses a battery and a small heating component the vaporize the e-liquid. This vapor can then be inhaled and exhaled 40111

  7. 902024 700474It is actually a cool and helpful piece of information. Im glad that you basically shared this useful information with us. Please stay us informed like this. Thank you for sharing. 831792

Leave a Reply

Your email address will not be published. Required fields are marked *