Problem statement: https://codeforces.com/contest/924/problem/B

My submission (Using binary search approach): https://codeforces.com/contest/924/submission/89608314

My submission (Using two-pointers approach):https://codeforces.com/contest/924/submission/89602356

In this problem, I came up with two approaches which seem asynchronous to the editorial's solution. One using binary search and the other using the two pointers technique. However, both of my implementations WA-ed on testcase 14 with the same exact answer. I suspect that I am either doing something wrong with my logic and implementation or it is just some sort of annoying precision kind of error. (eg, rounding wrong, not precise enough, off by like 10^-8).

I would appreciate it if anyone would point out my error, or give me a hint. I spent a long time reading through the editorial many times, but still can't find my error.

Thank's in advance!

Never mind, I found out my error

UPD: Got it correct! (I just modified the behavior of my pointers in my 2 pointers code and it worked)