I solved this problem theoretically and checked ability of a jump by counting the discriminant of square equation. I got WA on tests 30-32 using floating point numbers and trying to find good precision (type double in C) and rewrote my program using long integer type (long long) with no precisions. The first thing I noticed is that I got WA on test 20 when I say that jump is possible if D>=0. If I check D>0, I get WA on test 32. I'm sure it's not correct, because if D=0 exactly jump is still possible. I thought the problem could be in overflowing. Despite long long must be enough, I rewrote the program in Python 3 to avoid overflowing for sure and nothing changed. So I think I am right and there are wrong tests. I can show my source code if needed.
I keep getting wrong answer for test 13 and I have no clue whatsoever of the reason. I am using integer values (long long) in this problem and always check if the flea can go left->right->left->head OR right->left->right->head. Moreover, I consider different scenarios: * Pure vertical jump (dx = 0), and I only allow an upward jump in this case (otherwise it would be a simple fall with no effort); * Horizontal jump (dy = 0): I apply the formula for the maximum horizontal range (with theta = 45 degrees); * Upward jump with horizontal move: I calculate the minimum initial horizontal and vertical speeds (as it is a parabolic trajectory, I try to check if there is an initial configuration such that the vertex of the parabola (with Vy = 0) coincides with the final position; * Fall with horizontal move (dy < 0 and dx != 0): In this case, I consider that the flea only has non null initial horizontal speed and check if the horizontal distance is enough to reach the final point.
So that is it. Thank you very much for eventual answers.