So i am solving a question named verse for santa of educational codeforces round 79. I have written my code using binary search https://mirror.codeforces.com/contest/1279/submission/79356510 The problem is for the testcases give in the question my code is giving the correct answer on my system(I code on jdoodle Online C++ 14 Compiler IDE), but giving different answer when i am submitting it to codeforces. Please help!
Did you consider different sizes of data types on your system and codeforces?
what do you mean?
Maybe your system is 64-bit while codeforces is 32-bit (actually I know nothing about codeforces, just a guess).
I guess your variable 'ma' has not been assigned yet.
No i checked it is fine.
when i > 0, you compare v[i] and ma. But in this case, ma has no assigned value. It may lead to 'undefined behavior'
but before that i am assigning a value to ma when i=0. So there is no undefined behavior. If you still have doubt copy my code, run on your system for the first test case .
How to say??? You declare int ma, index; inside the loop. Thus, once you iterate i, the variable 'ma' is declared again. Plzz
ma is redefined on each iteration and has no assigned value on iterations 1+.
you should declare 'ma' outside the loop!
Yes apologies. I was wrong . It solved the problem. Thnak you!!! :)
Same problem for me in this submission: 134321653. When I build and run this code in geany on ubuntu I get correct output, but when I submit it on codeforces it looks like I didn't output anything.
Don't use ios_base and cin.tie(0) with scanf together.
Wow that was fast reply! Thank you so much, you solved my issue. :D
hey, I am also getting the same issue in Codeforces Round 944 (Div. 4), for Eth problem on 21th testcase I am getting wrong output but when I run it on some other compiler for the same testcases it shows correct output, this is my submission 260484076
please help
same shit bro, i already write blog about it some time ago, and not one gived clear solution