494A Div 1 Treasure Problem

Revision en1, by BanazadehAria, 2019-06-06 14:30:25

I have written this code for problem 494A Div 1 Treasure Link==>https://mirror.codeforces.com/problemset/problem/494/A code==>55202990 My idea is that start from left and always have the differences between '(' and ')' (How many '(' with no ')' match we have ==> name this variable l)

and then every time we get to an '#' we get the numbers of continuous ')' after that '#' until we face a '('. then the answer for that '#' is cnt(number of continuous ')' from '#') — l .

But my code gets WA for test case 10 what is the problem with my observation?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English BanazadehAria 2019-06-06 14:30:25 597 Initial revision (published)