### zhugezy's blog

By zhugezy, history, 5 weeks ago,

I met with some weird problems when solving https://codeforces.com/contest/1599/problem/C The question is simple, but plz take a look at these 4 submissions below:

### Case 1:

https://codeforces.com/contest/1599/submission/133010155

https://codeforces.com/contest/1599/submission/133010068

The only difference is the "inline" of the function double mypr.

### Case 2:

https://codeforces.com/contest/1599/submission/133012557

https://codeforces.com/contest/1599/submission/133012618

The only difference is the "cout" line in function int solve.

Compiler: GNU G++14 6.4.0

Everything works fine on my local environment, G++11/14 or else.

So is there any problem with codeforces, or is it my fault?

• +22

 » 5 weeks ago, # |   0 Auto comment: topic has been updated by zhugezy (previous revision, new revision, compare).
 » 5 weeks ago, # |   0 Worse still, I got AC when I copied your WA code in Case 1 and ran it on C++20, but it would be wrong in C++17... https://codeforces.com/contest/1599/submission/133026237Could it be the implementation?
•  » » 5 weeks ago, # ^ |   0 I got an AC with #define double long double just now, so absolutely there is precision loss here... but it's still confusing that inline or cout could get the result modified.https://codeforces.com/contest/1599/submission/133032524
 » 5 weeks ago, # |   +19 Observing The Universe Really Does Change The Outcome, And This Experiment Shows HowWhen you use cout, you "observe" it, I think it has something to do with Quantum Entanglement.
•  » » 5 weeks ago, # ^ |   0 was just taking consideration of this theory XD
•  » » 5 weeks ago, # ^ |   +14 And YOU hate NERDs?
 » 5 weeks ago, # |   +11 I think the WA is caused by this line if (temp >= p) return m;. When temp is equal to p, the judgment may still be false due to the precision of floating point numbers, You show that gcc is not stable when compiling different codes, although their logic is exactly the same. So I guess it will pass by changing the code like this if (temp >= p - 1e-6) return m;. 133048370
•  » » 5 weeks ago, # ^ | ← Rev. 2 →   +10 So looks like it's some kind of compiler issues leading to different compiling behaviours. May try going deep into it. Very useful, thx!