Long time no problem, the opening of virtual hot warm-up.
A construct, my method is, take 1,2,3...,k these several difference value, the former k+1 number is 1, k+1, 2, K, ..., then k+2, k+3, ..., n
B because the problem set is with the operation. We follow each person to come, if there is a limit of a bit is 1, then the interval flag 1, no limit the bit all 0 can be, and then verify that the bit 0 is all 1. Mark an interval can be marked by the method, the test can be summed to see the difference in value.
C I looked at CF tutorial and I did not do the same thing. My approach is less complex than his, but the solution is handsome, and run out of the same speed as if.
My practice is to enumerate friend using each string, BFS see which bits can exactly determine this string! Complexity has been down. Until I found a little trick. Interested to see http://codeforces.com/contest/482/submission/9351777
D If you do not consider the dyeing order of the subtree is a very water problem. So I think that just find a few no matter the opposite to come to the same dyeing scheme on the line, because each subtrees tree from the root node dyeing, so it is obvious that the left sibling subtree all staining nodes and equal to the right sibling subtree all staining nodes and. It is clear that either of these brothers is an odd number of stains, or even a few. (because if an odd number, left and right is necessarily an even number, then the overall and is odd, if there is an even number, left and right and odd, overall and even, then the contradiction, even the same is the same) after the random. specific to see http://codeforces.com/contest/482/submission/9353680
Codeforces Round #275 (Div.1) solution