pikafan_8080's blog

By pikafan_8080, history, 4 years ago, In English

Hello Codeforces!

I am trying to solve the problem 1256D - Binary String Minimizing, which is from the Codeforces Round 598 (Div. 3). I am getting the verdict as wrong answer on submission 74687091.

After seeing the verdict as wrong answer, I checked my program, and also tested it against few test cases. However, since I could not find any fault in my program, I finally decided to see the test case against which my code was giving wrong answer.

Since I had got the verdict as wrong answer on test case 15, I checked it. Against test case number 15, I found that:

  1. The output given by my program was empty.
  2. The checker comment was: "wrong answer Unexpected EOF in the participants output".

So, I concluded that I am getting the verdict as wrong answer most likely because of the fact that my program in not producing the output for this test case.

However, I am unable to fix this problem. I shall be happy if someone could point out why my code is not printing the output for this test case.

Please note that I do have seen the blog posts of some users who had the same problem. Unfortunately, none of them seems to help me. Please do not consider this as a duplicate of those posts.

Thanks for helping me!

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

»
4 years ago, # |
Rev. 2   Vote: I like it +11 Vote: I do not like it

In the constraints, $$$k \leq n^2 \leq (10^6)^2 = 10^{12}$$$. So your solution is overflowing. I have no idea why this causes it to print an empty string. But here's the accepted submission, with k as a long long.

As another note, this bug is reproducible for any $$$k$$$ that overflows, so a case like

1
1 9428683473
0

will also print an empty string. If you want, you can test this on custom invocation and maybe get more insight into this.

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

    Thanks a lot for pointing out this mistake. I agree that I didn't consider the constraints seriously.

    Once again, thanks a lot for helping me.

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

I have same problem with this submission. I cannot find any mistake, and it runs correctly on my computer.