Formula VS binary search (precision issue on AtCoder)

Revision en3, by polosatic, 2024-06-02 15:34:26

Recently I was upsolving this problem. My subtask was as follows: given three points: A, B, C, and I need to find the intersection point of 2 lines: AB and OC, where O has (0;0) coordinates.

Code, 90/92 tests passed

At first I wrote this using a formula (find() function) and got WA on 2 tests. Then I wrote it using binary search (findgood() function) and got AC. Then I submitted the solution above with find() and #define ld __float128, and it passed.

Can anybody explain what actually happened? How can formula be less precise than binary search?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English polosatic 2024-06-02 15:34:26 0 (published)
en2 English polosatic 2024-06-02 15:34:01 3 (saved to drafts)
ru1 Russian polosatic 2024-06-02 15:33:39 3400 Первая редакция перевода на Русский
en1 English polosatic 2024-06-02 14:59:23 3382 Initial revision (published)