接触codeforces时间不长,也就参加了10场左右。之前有次比赛就出现了wa了一道题,在比赛结束后看测试数据log时,发现出错的那组用例是个超过一万行输入的情况,codeforces上的测试数据无法完全显示,也就没办法复制后台出问题的测试数据,导致想在比赛后纠错却无从下手。昨天(2017.2.2)的比赛时同样遇到了这个情况。题目如下:
Each New Year Timofey and his friends cut down a tree of n vertices and bring it home. After that they paint all the n its vertices, so that the i-th vertex gets color ci.
Now it's time for Timofey birthday, and his mother asked him to remove the tree. Timofey removes the tree in the following way: he takes some vertex in hands, while all the other vertices move down so that the tree becomes rooted at the chosen vertex. After that Timofey brings the tree to a trash can.
Timofey doesn't like it when many colors are mixing together. A subtree annoys him if there are vertices of different color in it. Timofey wants to find a vertex which he should ta