Common BoardCould anyone give me some similar test case like test 5? I am having some problems with this one. Also, I have a question about the task. Is this situation possible: +1 +2 -2 -1 +2 -2 +1 -1 My question is pointing at this: After the first moment, first master will call mage 1 (+1) and second master will call mage 2 (+2). In the second moment, is the first master able to call mage 2 since the second master is letting the mage 2 go in the exact same moment? see this 1 6 6 2 + 1 - 1 + 1 + 2 - 1 - 2 + 1 - 1 + 2 + 1 - 1 - 2 answer: :-( My program gives correct answer for that test case but sill WA i can't figure out why. Can you give me other tests? I can't find what's wrong... I used DP, a[i][j] - true - iff Sandro begin i-th step, and Zagamius j-th. little hint: if mag[i] == mag[j] and both are '+' then a[i][j] = false. Easy problem. P.S. If you have WA#2 check this tests 3 -> 3 2 -> 2 1 -> 1 #include <stdio.h> #include <math.h> unsigned long long a[70000]; int main() { unsigned long long i,k,n,x; scanf("%ull\n",&n); for(i=0;i<n;i++) { scanf("%ull",&a[i]); } for(i=0;i<n;i++) { k=(8*a[i]-7); x=a[i]*a[i]; if(x==k) { printf("1 "); } else { printf("0 "); } } return 0; } #include <stdio.h> #include <math.h> unsigned long long a[70000]; int main() { unsigned long long i,k,n; long double x; scanf("%ull\n",&n); for(i=0;i<n;i++) { scanf("%ull",&a[i]); } for(i=0;i<n;i++) { k=(8*a[i]-7); x=a[i]*a[i]; if(x==k) { printf("1 "); } else { printf("0 "); } } return 0; } all test that i did was correct but i received Wrong answer 1. all tests that writed people i did and they was correct I have a problem when comparing real numbers private static double EPS = 0.33333333333333; public static boolean eq (double a, double b) { return Math.abs (a - b) <EPS; } when checking whether a given point belongs to a parabola, I simply substitutes the x and y the function (y = x ^ 2 * a + x * b) I can not pass the test 57 Edited by author 18.09.2012 18:13 Edited by author 27.05.2014 23:45 the fact that a decrease in EPS say up to 1E-10 then the program does not pass the test 13 Edited by author 18.09.2012 19:14 Edited by author 27.05.2014 23:46 I found a suitable number: 0.000050010002, but it is only for java (passes 62nd), for C++10 does not work, a stop on the 57th. Apparently my solution is not suitable for this task. Edited by author 27.05.2014 23:46 Set aside the alarm! Number: 1e-8. (I found on the forum) #define ┌ 218 #define ┘ 217 #define └ 192 #define ┐ 191 #define ─ 196 #define │ 179 #define N 20 #define M 50 unsigned char A[N][M + 1]; int main() { int i, j; for (i = 0; i < N; i++) { for (j = 0; j < M; j++) A[i][j] = getchar(); if (getchar() != '\n') throw 1; } } /* .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ...........┌─────┐................................ ...........│.....│................................ ....┌──────│.....│..........┌─┐................... ....│......│.....│..........│.│................... ....│......│.....│..........└─┘................... ....│......│....┌│────┐.............┌─┐........... ....│......└─────┘....│.............│.│........... ....│......│....│.....│.............└─┘........... ....│......│....│.....│.........┌──┐.............. ....└──────┘....│.....│.........│..│.............. ................│.....│.........│..│.............. ................└─────┘.........└──┘.............. .................................................. .................................................. */ Edited by author 27.05.2014 23:01 Edited by author 01.06.2014 00:29 This case was a corner usecase. This talks about the scenario where the driver offers less than what the traveller is trying to pay. Example: 11 1 10 2. Since the traveller/Petr can never do a '-' operation, he has to satisfy for 11. Thanks, ElPsyCongroo. x^2 + y^2 = A * p + k; you use this simple algorithm: A = [0....p] and simple Check: first time : y = 0 and x = sqrt(A*p + k) if(x*x == A*p + k) you should Print this answer: x and y else second time: x = (int) sqrt(A*p + k) and y = sqrt(A*p + k - (int)x*x) if(x*x + y*y == A*p + k) you should Print this answer : x and y else continue and increasing only ONE count of A Sorry my English... Edited by author 04.01.2014 13:44 Edited by author 26.05.2014 22:39 1000000000 1000000001 100000000000000000 1000000000000000000 for such kind of tests my solution works more than 10 sec, here I got AC in 0.031. I agree with you. I don`t think so! Confirming this test has to be added. My solution that got AC on the contest gets TLE on it. Use print '%.16f' % (result) instead of print result Var n:LongInt; Begin Read(n); if n in [1..4] then writeLn('few'); if n in [5..9] then writeLn('several'); if n in [10..19] then writeLn('pack'); if n in [20..49] then writeLn('lots'); if n in [50..99] then writeLn('horde'); if n in [100..249] then writeLn('throng'); if ((n>=250) and (n<=499)) then writeLn('swarm'); if ((n>=500) and (n<=999)) then writeLn('zounds'); if n>=1000 then writeLn('legion'); end. Tell input data for test number 8, please ! :) 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 write question and find the ansver my selve, so i delete the question to not bother you. But i dont now hav to erase my qestion, so i vrite this thing. Sory for litter on your forum. Ps. And sorry for my english. Edited by author 05.10.2012 16:16 Next time leave the question and answer it yourself, it may help someone else! #include <stdio.h> #include <math.h> double stack[131073]; int main() { int index = -1; while(scanf("%lf", &stack[++index]) != EOF); for(; index > 0;printf("%.4lf\n", sqrt(stack[--index]))); return 0; } If the digit is negative? If the digit is negative? Just use the same method, and append "i" to denote the imaginary number. If the digit is negative? lol 0<=A<=10^18 read description :P Edited by author 21.11.2013 00:35 Edited by author 21.11.2013 00:35Hi, can this code be accepted? The input value can be much larger than double value, even long type. A strange fact: [...] double b[100000000]; int i = 0; int main(){ while (scanf("%lf", &b[i++]) == 1); i--; while (i > 0) printf("%.4lf\n", sqrt((double)b[--i])); return 0; } Get AC BUT: [...] long long b[100000000]; int i = 0; int main(){ long long a; while (scanf("%lld", &b[i++]) == 1); i--; while (i > 0) printf("%.4lf\n", sqrt((double)b[--i])); return 0; } Gets WA 1. I understand nothing in this life..=) I wonder where may be mistake? Compiler G++ 4.7.2 Mingw gcc does not recognize %lld, use %I64u. And now it does not work with %.4lf in printf, only with %.4f (in C++11 mode). Well, it should be double not long long since the output is in real number A strange fact: [...] double b[100000000]; int i = 0; int main(){ while (scanf("%lf", &b[i++]) == 1); i--; while (i > 0) printf("%.4lf\n", sqrt((double)b[--i])); return 0; } Get AC BUT: [...] long long b[100000000]; int i = 0; int main(){ long long a; while (scanf("%lld", &b[i++]) == 1); i--; while (i > 0) printf("%.4lf\n", sqrt((double)b[--i])); return 0; } Gets WA 1. I understand nothing in this life..=) I wonder where may be mistake? Compiler G++ 4.7.2 this is simple test for TEST 25. 10 -1 0 1 2 0 0 -1 -1 -1 2 Answer : 2 1 2 Edited by author 07.11.2013 16:13 That's not a valid test since you can't begin with -1, popping an empty stack. |
|