When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

yesbutno1685's blog

By yesbutno1685, history, 4 years ago, In English

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!

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?