Please, try EDU on Codeforces! New educational section with videos, subtitles, texts, and problems. ×

kaiyu2000's blog

By kaiyu2000, history, 4 weeks ago, In English,


My Submission:

Test Case which it fails on: 7 576460752303423481

Correct Answer: -1

Answer when you run it locally:-1

Answer by Codeforces System:1

You can check the test case details of my submission.

Why Codeforces gives WA on this code?

I ran the code on CLion by JetBrains.

Also I ran it on Codeforces Custom Invocation:

It gave -1 as expected, but while testing my code idk why it gave WA.

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

4 weeks ago, # |
Rev. 2   Vote: I like it +16 Vote: I do not like it

If you try the first 8 tests together on Custom Invocation, you will get the same wrong answer.

So, I thought the problem is in using puts while using synchronized input/output (fio). And yes, that was the problem.

In general, don't use C++ input/output with C input/output. Either use scanf/printf/puts or cin/cout with/without synchronization.