Original link: https://www.shuizilong.com/house/archives/atcoder-grand-contest-059/
Problem A. My Last ABC Problem
Only came up with violent dp. . . The key is to examine the number of different adjacent positions in the interval. .
Set to x, the answer is the ceil(x/2) of this value, which proves that the pigeonhole principle can be used.
Problem B. Arrange Your Balls
On the contrary, I think it is simpler than A, sorting from large to small, just construct dfs().
This article is transferred from: https://www.shuizilong.com/house/archives/atcoder-grand-contest-059/
This site is only for collection, and the copyright belongs to the original author.