|
|
Общий форумds:=sqr(b)-a*c; the checking must look like this if ds+0.000000000001>=0 then ... Also when I calculated square roots for a*t^2 + 2*b*t + c = 0 as t1,2 = (-b +- sqrt(b^2 - a*c)) / a I had wa3. When I use b = 2.0 * b t1,2 = (-b +- sqrt(b^2 - 4.0*a*c)) / (2.0*a) I got AC. It is very curiously... I has WA#3. Even, i use check ds+0.000000000001>=0. I don't understand what's wrong. :( Can you talk me what in test 3? If ds passes this test, it may be less than zero. so, if it is less than zero, reset it to zero. otherwise, sqrt won't perform as expected. Also check for possible -0.000 replies (that happens in printf("%.3lf") when number is negative, but becomes zero after round-up). Some checkers do not like that. Is negative time a possible answer? :( There is curious fact, that you can get AC with eps = .1! Most important do not forget about: If ds passes this test, it may be less than zero. so, if it is less than zero, reset it to zero. otherwise, sqrt won't perform as expected. I also checked abs(ds) < eps , then t = -b/(2*a) Without it, it was WA3 THIS TEST 6 5 1 3 6 3 11112 22221 11112 22212 21112 22222 ANS:7 1 qwq Edited by author 23.07.2023 08:21 I am using Dijkstra's algorithm(and skip first vertex). I output a list of names whose shortest distance is less 141. I can't find the tests that crack my solution... Give me tests, please) When a user retweets, It is NOT their name that is added to the line! OMG, I had the same stupid mistake! Give me some tests, please Edited by author 11.11.2008 23:43 abab answer - 7 It helped me with WA3 (Z-function O(N^2) solution) rthfdffdfdfffffdddffdgdfdfdg answer - 349 hshhflgseiuajsliouew answer - 202 gggfffgggghhhhghh answer - 126 aaaabbbbfghjjlltrgttcdssdbnpoiuyewtdarsuorprpooeuyywdgfxsdkkvcjbidfryieiue answer - 2713 Edited by author 02.02.2009 20:14 Edited by author 02.02.2009 20:21 If you use Z-function don't forget re-initialize z-array before each iteration!!! z[0]..z[i] = {0} hm... This are tests successful, but error on 1 test try bbbabbbababb answer is 51 999 987.23 answer 934270.79 3 100 answer 0.00 4 1000 answer 0.00 5 12 answer 0.00 thank you. Try this if you have WA3. eps >= 1e-9 - WA26 eps = 1e-7 - AC plese help test 104 Obviously sqrt(1e18) operations will TLE. You need to do factorization smarter. Perhaps some divisors are not needed to find the solution? 4 5 4 5 1 2 2 1 2 3 3 2 3 4 ans: 14 Edited by author 15.07.2023 07:47 I used my own hash map with modulo 1e5, and buckets with size equal to one it's the case where count of '(' is greater than ')'. For example: (( or (() its wa is something like a Ivan's Car problem [code deleted] Edited by moderator 27.07.2023 17:22 I know that 12th test is so big. Maybe it will help you Edited by author 19.09.2012 02:57 the solution in C++ gave WA12, but the same algorithm in Python gave AC. I think, overflow is comming. There is no checker in this problem. In my solution I 1. Print new line after query even if there is no strings which satisfy it 2. Don't print new line after last query Pls, explain me why i'm wrong Let T is answer. t in [0,T]: x(t)=vx*t, y(t)=vy*t-g*t^2/2 t > T: x(t) = x(T) + (vx+ux)(t-T) = (vx+ux)t - ux*T y(t) = y(T) + (vy - g*T + uy)*(t-T)-g * (t-T)^2/2 = (-g/2)*t^2 + (vy+uy)*t-y*T t1, t2: x(t1)=L, x(t2)=L+l t1 = (L+ux*T)/(vx+ux) t2 = (L+l+ux*T)/(vx+ux) tv: y'(tv)=0, tv = (vy+uy)/g Then i use conditions: 0<T<L/vx, T<2*vy/g h<y(t1)<h+d, h<y(t2)<h+d if tv in (T-eps, T+eps) then y(tv)<h+d My algo: find all candidates from conditions and then check that candidate is good My code: [code deleted] Edited by moderator 27.07.2023 17:23 "Nod can throw a stone with an ABSOLUTE initial speed (ux, uy)." 5 0 0 4 0 4 2 2 4 0 2 answer: 3.640719 |
|
|