After the success of 2nd anniversary (take a look at problem FTOUR for more details), this 3rd year, Travel Agent SPOJ goes on with another discount tour. The tour will be held on ICPC island, a miraculous one on the Pacific Ocean. We list N places (…
After the success of 2nd anniversary (take a look at problem FTOUR for more details), this 3rd year, Travel Agent SPOJ goes on with another discount tour. The tour will be held on ICPC island, a miraculous one on the Pacific Ocean. We list N places (…
摘自Codeforces博客 With dsu on tree we can answer queries of this type: How many vertices in subtree of vertex v has some property in O(n lg n) time (for all of the queries). For example: Given a tree, every vertex has color. Query is how many vertices i…