dvjakhar31's blog

By dvjakhar31, history, 14 months ago, In English

Hello codeforces here is my code for C1 Prefix Flip(Easy Version) and when I submit it, I get Memory limit exceeded on test 2. Can you help me finding why it is so? as I can't find. Please see my code it doesn't have so many macros, so you get confused. Thanks, I love this community.

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

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

Try while(s[j]==t[j]&&j>=0)

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

    Bro, thanks for your reply, but it didn't help and error remains.

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

      There seems to be some logical error wherein your j never reaches 0. The vector keeps growing and gives you a MLE. Not sure but you can try debugging on these lines

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

        You are right, I did some debugging and found that j wasn't decreasing at some step. Now I get it accepted thanks!!