Блог пользователя CODESofRishi

Автор CODESofRishi, история, 4 года назад, По-английски

I have an issue! Can anyone pls help in resolving it.

I tried submitting code for the problem: Uncowed Forces

My Solution: My Code

Even though my code is giving correct output on my machine for the test case:

55 66 75 44 47
6 0 6 6 10
19 0

CORRECT OUTPUT: 6414

But on submitting Codeforces is generating output 6413, hence giving the verdict as Wrong Answer!

Why is this the case?

Is there something wrong with my implementation?

Or is there any issue from Codeforces side?

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

You are using double. Try submitting with gnu c++17 (64 bit msys 2) It will process the mode accurate result and your code will get accepted.

  • »
    »
    4 года назад, # ^ |
    Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

    Yes it worked! But, can you please elaborate more about it!?

    What you are saying is, can one not use double in the usual C++17 option?

    Also can you pls specify the difference in C++17 && C++17(64bit) options on Codeforces?

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится +10 Проголосовать: не нравится

      double is a floating-point type, which is inaccurate in its nature.

      Don't use it when it's not necessary.