sarusama's blog

By sarusama, history, 10 years ago, In English

my code : 20895807

input : AABCDEFGHIJKLMNOPQRSTUVW??M

in my PC : -1

in server : AABCDEFGHIJKLMNOPQRSTUVWAAM

am I miss something?

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

»
10 years ago, hide # |
Rev. 2  
Vote: I like it +16 Vote: I do not like it

a) do not EVER use strlen(...) in for condition. It's invoked in every iteration.

b) the problem is: for(int r=r+1, l=l+1; ... use other names.

in general, if you get different output on your pc, your program behaves in non-deterministac way, because e.g you read from non-existing cell of array (out of bounds).