avighnakc's blog

By avighnakc, 5 months ago, In English

Hello codeforces! Recently I was solving solar storm from NOI 2020's preliminary round on oj.uz. I made the following submission, which unfortunately WAed.

Spoiler

So I tried debugging it. I made several attempts, after which I decided to just look at the test data to see what I was failing. And this is the weirdest part, according to the official checker, my answer for 5-14 matches the optimal answer.

Multiple AC codes gave the exact same output that mine is givng.

(Note that I did also use the checker, and it also said that my answer was right.)

So then I thought of the next obvious issue: some kind of undefined behaviour? I checked this using valgrind (after commenting out my fast IO), and, unfortunately, there is none.

I also looked at the code of some AC submissions, and thier logic is almost identical to mine, so at this point, I really have no clue what I'm doing wrong, or what I can even do to debug this further (is there some way to see what my code was outputting when it received the wrong answer?) Please let me know if you do. Thank you!

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

»
5 months ago, # |
  Vote: I like it +6 Vote: I do not like it

It seems that the testcases do not match up between oj.uz and the linked github. For example, we can see that your submission runs on 31 testcases for Subtask 3, but only 9 exist in the github.

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Update: I found my mistake. It turns out I was jumping to the farthest index that is not protected by a shield at $$$i$$$ instead of jumping to the farthest index such that all modules in the middle are protected. I don’t know how I overlooked this.

»
5 months ago, # |
  Vote: I like it +3 Vote: I do not like it

y u work so hard