hackslash_123's blog

By hackslash_123, history, 5 years ago, In English

In yesterday's Educational round contest(link), my solution for problem C got failed on system testing, but the same solution got passed when I submitted again after the contest . Can anyone help me out ?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
5 years ago, # |
  Vote: I like it +7 Vote: I do not like it

You tried to reach negative array index when you are trying to get the sum. Change low to 1 and you will not encounter undefined behaviour. Sometimes even Undefined Behaviour could pass. It's a bit of random thing.