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

Автор ColdWinters, история, 9 лет назад, По-английски

Hello,

I'm trying to solve the B problem of the Div2 Round #382.

I'm getting the correct answer when i compile on my system with gcc version 5.3.1 but when i submit I get WA on the very first test case. Om my system i get "6.00000000", which is the right answer, but when i submit i get a "0.00000000".Can anybody help me?

Problem statement: http://mirror.codeforces.com/contest/735/problem/B Submission: http://mirror.codeforces.com/contest/735/submission/22645993

Thanks in Advance :)

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

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

Try submitting in c++14 instead of C11.

»
9 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится +5 Проголосовать: не нравится

Maybe the results are different since qsort is a randomized algorithm.

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

The problem is that you're using %lf in the printf when you should use %f.

Note that %lf is only used for doubles in scanf.

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

It's interesting why GCC GNU C11 works strange. Use GCC C++. Bad news for you: your algo is wrong (may be). See my submission: http://mirror.codeforces.com/contest/735/submission/22649713 upd: Sorry, your algo is right, only need to use long long for 'a' and 'b' variables :) see http://mirror.codeforces.com/contest/735/submission/22649947