hulm's blog

By hulm, history, 7 months ago, translation, In English

Hello dear CodeForces community!

I was solving this problem and submitted a solution, which should pass all sample tests. However, it is falling on the second test, where answer is 4. Everything is ok on my local machine, but for some reason it is returning 1 on CodeForces.

Next, I went to run the code and see my output on Custom Test. For GNU G++20 13.2(64 bit, winlibs) my output is 1.

But for GNU G++17 I am getting the correct answer!

So, I decided to submit my solution on using C++17, but still getting 1. Very strange.

Please, if you know what is happening, can you help me?

My submission with C++20: Click

My submission with C++17: Click

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

»
7 months ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

I found the problem. It was on the 48-th line, because $$$j$$$ could be negative, which led to negative indexing.