Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Mysterious behaviour of the sqrt() function

Revision en1, by yud08, 2024-09-30 01:07:44

So I was trying to blitz my way through ABC in the last Div 2 as per usual, when, shockingly, I received the verdict "Wrong answer on test 8" for B(actually, a quite regular occurrence). I just thought it was an issue with the sqrt() function, so I coded a binary search version for the sqrt and moved on. However, after the contest, I resubmitted in C++17(I was using C++20), and it somehow passes? Also, when prompted by my friend, I added #pragma GCC target("avx2") to that submission, and it somehow failed again. Could someone please explain what's happening here?

Failing submission(C++20)
Accepted submission(C++17)
Failing submission(with pragma)

Tags c++, sqrt, idk some random tag

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English yud08 2024-09-30 01:07:44 898 Initial revision (published)