CP_Sucks's blog

By CP_Sucks, history, 4 years ago, In English

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

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

Thanks in advance.

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

| Write comment?
»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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

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

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

»
4 years 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 years 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.