Can anyone get me the solution of https://www.codechef.com/COWH2017/problems/COWHR102/ Thanks in advance asked 09 Aug, 19:32

I think you can refer to catlan number. Thinking Catlna number denotes the number of "balanced bracket sequences" (known fact). [Balance bracket sequences mean, The sequence of brackets of "{" and "}" is closed, eg "{{{}}}".] Assume husband to be '{' and wife to be '}' . Now, the condition reduces to, that, the brackets should be balanced. (A bracket sequence can never be balanced if "}" comes before "{"Equivalent to a wife sitting before her husband) Try this approach and see if it works. If it doesnt, get back to me, didnt tested yet. Kind of stuck atm :( answered 09 Aug, 23:40
Ok...I will try
(10 Aug, 00:22)
Refer to wiki for catlan number. Geeksforgeeks for generation, or else you can simply store first 20 catlan numbers in an array and be done with. If it doesnt work, tell me.
(10 Aug, 00:24)
It is not working in my case. I don't know why. I just used the code of gfg to generate the Catalan numbers and printed as it was asked. Have I done something wrong? https://www.codechef.com/viewsolution/14895067
(10 Aug, 14:55)
@vijju123 Will you please have a look.
(10 Aug, 17:27)
I am looking into it right now. Sorry for delay, things are coming up and keeping me busy.
(10 Aug, 17:54)
The matter is solved. The test cases are INCORRECT (as i suspected since its a excontest problem). The setter included the case for N=0 (for which he assumed answer to be 0) while constraints mention that N is between [1,20). Also, i kind of dont agree with answer being 1 for N=0. You have nobody, so empty set could be an answer. Anyway, its just that, the constraints are incorrect. There is a case of N=0.
(10 Aug, 18:35)
No problem, I can understand : EDIT: Oh I wrote it for your previous comment. Btw Thanks. I was really wondering why it's not working.:)
(10 Aug, 20:21)
Correction 
Its i kind of dont agree with answer being 0 for N=0, since we have empty set. Sorry for confusion, idk what was on my mind.
(10 Aug, 20:25)
showing 5 of 8
show all

@vijju123 How to count...any idea ?