yagyanshbhatia's blog

By yagyanshbhatia, history, 3 months ago, In English,

While solving the problem http://codeforces.com/contest/264/problem/A I submitted the solution but it's giving RTE on test case 41. Any help?

 
 
 
 
  • Vote: I like it  
  • +3
  • Vote: I do not like it  

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

You have undefined behavior from line 24 to 27. When "left" is empty, you are trying to access out-of-range element.

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

    That was it! thank you so much :) If you see an RTE what things do you have in mind to check (if its a segmentation fault, we see invalid memory access) generally?