I was solving national OI when I stumbled across this (simple?) problem which I was unable to solve.
"Given N and K find the k-th lexicographically correct parenthesis of length N".
Example:
N = 4 k = 2
()()
Thanks in advance! Hope this question will help somebody else too.
what are the constrains for n and k?
N and K are up to 10000
You can find the solution here.
Thanks! What difficulty do you think this (problem) is? Because I don't want to try to solve something that is way above my level.