HI Everyone...
I came across this problem on UVa Safe Salutations I know that it can be solved with the Catalan Numbers but I wanna know WHY ???!! In other words I wanna know the proof that Catalan Numbers work on this problem... THANKS !!!
I came across this problem on UVa Safe Salutations I know that it can be solved with the Catalan Numbers but I wanna know WHY ???!! In other words I wanna know the proof that Catalan Numbers work on this problem... THANKS !!!
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3690 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | maomao90 | 174 |
2 | awoo | 164 |
3 | adamant | 163 |
4 | TheScrasse | 159 |
5 | nor | 157 |
6 | maroonrk | 155 |
7 | -is-this-fft- | 152 |
8 | Petr | 146 |
8 | orz | 146 |
10 | BledDest | 145 |
Название |
---|
Let all vertices be numbered from 1 to n at clockwise order starting from some vertice. Let's make such sequence b of n elements: if i-th vertice is connected with j and i < j, then b[i] = '(', else b[i] = ')'. Easy to understand, that if graph was correct, than b — is correct bracket sequence, and if graph wasn't correct than b is not correct bracket sequence. So, problem is equivalent to counting number of correct bracket sequences of length 2n and well-known that answer is n-th Catalan number.
Thank You! It seems kind of obvious now... But I still need the "Mathematical" proof !! Like why if I had n pairs of points and I wanna connect them in pairs without making intersection between the lines that connects them I can make this with Cat(n) of ways ??
Because this problem is equivalent to the problem of counting number of correct bracket sequences, so answer is same.