200417545 This is the submission that I made during the contest which got accepted on pretests but gave wrong answer on main test 15.
200514283 I made this submission after the contest and the only change I did was to change lower_bound to upper_bound and it got accepted.
If someone can figure out what is going wrong with lower_bound that would be awesome.








lower_bound() is used to return an iterator pointing to the first element in the range which has a value >= val. But the bound we're setting on K is (b — 2*sqrt(a*c) , b + 2*sqrt(a*c)). which is non inclusive of the extremities. lower bound may find the value of K which is equal to the left extremity in your case. But upper_bound() on the other hand returns an iterator pointing to the first element in the range which has a value strictly greater than val. the forementioned case is taken care of here and hence the solutions gets ac on upper_bound() and not on lower_bound()
my approach using lower_bound that got accepted submission
I think the issue with your solution is sqrt and doubles being imprecise rather than lower bound
You have to check both values, like suppose lower_bound gave you the value less than iterator to n-1 then check once at that point and also check at one point before that point. This does confirm your result cuz (b-k[i])^2 is positive either you go a bit far from b or you keep k[i] less than b.
When you use double, you give your fate to the god.
Why would you expect both submissions to receive the same verdict when
upper_bounddoes a different thing fromlower_bound?I was solving a problem,
maxgave the wrong answer whilemingave the correct answer.Sounds ridiculous? That's the same thing.
upper_boundandlower_boundare different functions. That they give different results isn't surprising.