Why am I always getting a WA on testcase 14

Revision en3, by yesbutno1685, 2020-08-11 23:53:34

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

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

My submission (Using two-pointers approach):https://mirror.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 or implementation of 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!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English yesbutno1685 2020-08-11 23:54:05 7
en3 English yesbutno1685 2020-08-11 23:53:34 2 Tiny change: 'nt. I spend a long ti' -> 'nt. I spent a long ti'
en2 English yesbutno1685 2020-08-11 23:53:18 93
en1 English yesbutno1685 2020-08-11 23:51:34 1044 Initial revision (published)