Editorial for COCI '07 Contest 1 #4 Zapis
Submitting an official solution before solving the problem yourself is a bannable offence.
We start by observing the first character in the sequence. That character must be an opening bracket. Its closing bracket can only be located at an even position in the sequence (because a regular bracket sequence has even length).
For each even position
By doing this we have reduced the large problem to two smaller subproblems of the same type, so it can be solved using dynamic programming or memoization.
Comments