Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

L_Drago_Destructor's blog

By L_Drago_Destructor, history, 4 years ago, In English

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.

»
4 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

what are the constrains for n and k?

»
4 years ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

You can find the solution here.