Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

once_twice's blog

By once_twice, history, 4 weeks ago, In English,

Can someone tell why i get MLE in Problem D of last round ?

https://codeforces.com/contest/1363/submission/82256919

Thanks in advance.

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

»
4 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

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

»
4 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

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

»
4 weeks ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

82259253 I simply added bunch of if(!~res) return 0; or if(s[0] == 'I') return 0;.

I think it's better not to ignore those If the subset of indices queried is invalid or you exceeded the number of queries (for example one of the indices is greater than n) then you will get x=−1. In this case, you should terminate the program immediately. or If the guessed password is incorrect, you will receive the string "Incorrect". In this case, you should terminate the program immediately. conditions. They're really there to help you debug.

If you find writing them everytime repetitive, you could just write a function which processes querying/answering like this.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Hmm , but it still gives WA, ok i will modularise code and then debug thanks.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks aeren , helped me find bug , now AC