|
|
if you get it, try to change g. i misread the statement and my g was equal to 9.81, not 9.8, then i fixed it and got AC 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. Edited by author 20.07.2015 18:27 By the way, I got AC on FreePascal using the condition that is less strict because of precisions. Approve this. Only condition D >= 0 allows test like this 0 0 1 0 0 0 2 There is additional check needed. This magic works: L^2*g^2<=(V^2-g*(y2-y1))^2 implem. in long long(g=98/10) Give me test 9 Don't know what kind of test it is, but precision troubles are quite likely in this problem. So, solve problem in integers to avoid them. I had WA on test 9 with a wrong formula for the movement equations, that worked on the samples, but was too weak to solve these tests (it would say "yes" to both): 14 0 20 0 10 0 0 Yes 14 0 20 0 9 0 0 No Try different epsilons. I got AC with solution that had WA 30,32,34 before that. And all that i changed was epsilon. Better solution would be to do all calculation in integer types (e.g. long long) - thus you avoid precision issues. Hello there, 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. Edited by author 25.05.2014 23:55 I have only one place where i'm dealing with doubles - trying to check B*B<4*A*C. Can it be a problem? If not, then probably something else is screwed up. UPD: Yes, in my case it was precision. I got rid of doubles in that check - got AC. Edited by author 17.01.2014 14:53 AC'ed authors, how could you fix this? Try to do all calculations in integer numbers I even replaced all the doubles with integers. But the result is the same. In my formula, overflow is possible even in long long, if computed straightforwardly. So, check that in your algo no overflow occurs. I have WA#11, though my decision is consisted only from integer numbers. What is possible problem? Edited by author 11.11.2013 17:03 Edited by author 11.11.2013 17:04 Edited by author 11.11.2013 17:04 I got WA#22. What is possible problem here? Precision issues are quite possible in this problem - so, try to solve it in integer numbers. But I saw AC solution in double without epsilon :) If you're quite lucky or tests are weak - it is possible, but anyway quite risky on the real contest. |
|
|