ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1574. Mathematicians and brackets

I can't understand the exaples
Posted by ONU_Latysh 11 Dec 2011 21:08
Are the answers in exanples the only solutions or are there maultiple ones!?
Re: I can't understand the exaples
Posted by vlyubin 8 Feb 2012 08:08
What we do is we repeatedly move the last bracket to the start of the list. If we have brackets 1234 then we test 1234,4123,3412,2341. On example 1 it is:
)(() , ))(( , ())( , (()) ; from which only the last option is OK. Thus the answer is one.

Hope that helps.
Re: I can't understand the exaples
Posted by Znorth 9 Feb 2012 16:58
But, why in example №2 answer 2?
sequence: )()(

1234 -> 4123
)()(    ()()

Answer must be 1.