adfadfs's blog

By adfadfs, history, 5 years ago, In English

I submitted the following two codes, which are essentially the same but one gives WA, the other got accepted.

WA code

AC code

(compare the two solutions to see the differences)

UPD: Perhaps this is not something just random, repeating the submissions still gives the same verdicts. I am unsure how assertions are affecting the code.

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

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

This needs the attention of some experienced programmers. I have no clue about this.

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

You can see possible undefined behavior when choosing right compiler. What I get, submitting this code is: Probably, the solution is executed with error 'out of bounds' on the line 150.

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

    Thank You! I now realize that there's an overflow in the Mex array.

    Wow, assertions have some 'undefined behavior' benefits as well :P