Problem:

N students are standing at distinct points in the X-axis. Every students will start running at t = 0. assign direction (left/right) to each of them such that the first time when any two students cross each other is as large as possible. Speed of every students is given.

i spent / wasted several hours on this question. the following are two of my many submissions :

the only difference between the 2 codes is that at line no.72 i used “double” in ‘1’ and “long double” in ‘2’.

there is absolutely no other difference between either submissions.

the first submission gives me AC where as the second gives me WA.

what could be the reason for this?

long double is as precise as double is if not better. then why the WA?