Los_Angelos_Laycurse's blog

By Los_Angelos_Laycurse, 10 years ago, In English

link: http://mirror.codeforces.com/gym/100517.

problem C Comb Avoiding Trees my solution for this problem is shorter than 40 lines(I often write long code and make problem more complex than itself when solving problems)

the key observasion of this problem is we must find every rooted binary tree correspond a bracket sequence(thinking in prufer coding)(i.e. something like (((()()()))). and avoid k means the depth of the bracket sequence is less than k. then very short dynamic programming can solve it,complexity O(n^2)