mir1198yusuf's blog

By mir1198yusuf, history, 15 months ago, In English

For the below testcase, what should be the output :

(()())()(())()()())())()((()(()(())()()())((()(())()(()()()()))()(())()(((()())()(()((())()(())(()))

My answer is :

No of substring = 7

length of longest sequence = 18

Can anyone confirm because I feel codeforces test case is wrong here.?

My code : https://codeforces.com/contest/5/submission/79013600

 
 
 
 
  • Vote: I like it
  • -2
  • Vote: I do not like it

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by mir1198yusuf (previous revision, new revision, compare).

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

you have to print longest bracket substring, in this test cas it is possible to obtain length 28 and then we have to print it's number of occurences, that is 1.

  • »
    »
    15 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks for reply...

    Can you tell me which string is valid and of length 28...because the max valid length I can find is 18. ?

»
15 months ago, # |
  Vote: I like it 0 Vote: I do not like it

finally figured out... here you have to print the number of substring having maxlength. Thanks @sumantopal07

»
6 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Good editorial