Recently, I was trying to solve the problem: 1288A - Deadline The submission: 68862578 The submission got accepted. If the compiler is changed to "GNU C++14" with the same code it gives the wrong answer in test 22; also, on test 50 it will give the same wrong answer it will output ("YES \n YES \n") I don't know which line that made the compilers give different output. Submission with "GNU C++14": 68867586 I tried to optimize the solution by this submission: 68864007 it gave the output ("YES \n YES \n") in test 50 No matter which compiler used. could anyone explain this behaviour? update: I found the problem. the problem was in using float instead of double. So, float accuracy was less than double.
Changing the following floating-point expression
to
was sufficient to get your code accepted in C++14 68870201. You can avoid the floating-point approximation error issue by using integer division 68870731.
as it is well known that the ceiling function of the ratio $$$x/y$$$ when $$$x$$$ and $$$y$$$ are positive integers, $$$\lceil x/y \rceil$$$, is equal to the quotient of the integer division $$$(x+y-1)/y$$$.