Hodobox's blog

By Hodobox, 10 years ago, In English

My submission for problem 451B (http://codeforces.me/problemset/problem/451/B) gives a wrong answer on test 26 according to the jury. Running the code on a custom test with the input of test 26 also gives the wrong answer. However when I run the code on my side, it gives the correct "yes 2 5" answer. I can't figure out why this is happening, or how to fix it. If someone could help me or at least run the code on their machine and let me know if the answer is correct or not on their side, that would be great :)

The submission: http://codeforces.me/contest/451/submission/10786678

Input that causes problems: 5 373362086 994096202 767275079 734424844 515504383

Correct answer: yes 2 5

Output I get when I run my code: yes 2 5

Output the jury says my code gives: no

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

»
10 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You're going out of array. Just added "i+1<n" to while loops — got AC: 10786876