Common BoardOh! I've found a mistake! Edited by author 07.06.2005 17:25 tell me! I crash too!! I have crash#1 when I work with files. The set of points is given, it is necessary to find the circle of the minimal radius covering them. Please, help me. My algo is O(n^4) but it very slow. void min_disk3 (point a, point b, point c, point &circ, double &r) { if (on_line (a, b, c)) { point p1 = minp (minp (a, b), c); point p2 = maxp (maxp (a, b), c); circ = part (p1, p2, 1, 1); r = 0.5 * dist (p1, p2); return; } point mab = part (a, b, 1, 1); point mac = part (a, c, 1, 1); double a1 = a.x - b.x; double b1 = a.y - b.y; double c1 = - a1 * mab.x - b1 * mab.y; double a2 = a.x - c.x; double b2 = a.y - c.y; double c2 = - a2 * mac.x - b2 * mac.y; double x, y; x = (b2 * c1 - b1 * c2) / (a2 * b1 - a1 * b2); if (!equald (b1, eps)) y = - (a1 * x + c1) / b1; else y = - (a2 * x + c2) / b2; circ = point (x, y); r = dist (circ, a); } void min_disk2 (point p[], int n, point a, point b, point &circ, double &r) { circ = part (a, b, 1, 1); r = dist (circ, a); for (int i = 0; i < n; ++ i) if (lessd (r, dist (p[i], circ))) min_disk3 (p[i], a, b, circ, r); } void min_disk1 (point p[], int n, point a, point &circ, double &r) { circ = part (p[0], a, 1, 1); r = dist (circ, a); for (int i = 1; i < n; ++ i) if (lessd (r, dist (p[i], circ))) min_disk2 (p, i, a, p[i], circ, r); } void min_disk (point p[], int n, point &circ, double &r) { circ = part (p[0], p[1], 1, 1); r = dist (circ, p[0]); for (int i = 2; i < n; ++ i) if (lessd (r, dist (p[i], circ))) min_disk1 (p, i, p[i], circ, r); } In test #4 n=10000 and k=1. You can write this case apart. Is there any good tests? Don't forget that \endinput is end of paragraph too. Osliki and T34 must get min and max simultaneously in one game? There is some strange algo, but AC. let we have two arrays of char[5]; Then we compare first diamond with SOME permutations of second, but that permutations is 1234 1342 1423 2143 2314 ... i.e. we miss two permutations of lexicographic sequence of all permutations, the take two, then miss two again. int compare_condition = 1; while (1) { if (compare_condition < 2) compare(diamond1, diamond2); if (eq){ cout << "equal" << endl; return 0; } compare_condition++; compare_condition %= 4; if (!next_permutation(p.begin(), p.end())) break; } This code works, but why??? Can anybody prove it??? Strange algo, isn't??? ATTENTION, PEOPLE! IT IS WRONG !!! Edited by author 18.12.2007 21:12 I've compared my computer with my friend's accepted program. I found that his main algorithm is to find the maximal viewing angle between (x1,0) and (x2,0) using binary search. But I have a random data like this "-41 328 150 467" my program output 0.528878 {which meet the peak value at (173.423285,0) on the right side of (x2,0)} but his program output 0.527316 {which meet the peak value at (150,0)} Must the programmer view the Billboard bewteen (x1,0) and (x2,0)? If I misunderstood the description of this problem,please tell me the right one. Thank you very much. my AC program returns 0.528878. Thank you very much! I will check my solution more carefully. My program passes all tests which I has found in a forum, and has thought up People!!! Please help me!!!Anybody know what input data in test#3??? I don't know why, If I write 'to trunc(sqrt(n))' ,it's wa, but if I write 'to trunc(sqrt(n))+100' ,it's ac. So, if you got wa ,you can try it ,may be you will get ac. p.s If you know why,please tell me,thank you. p.s I'm not live in English-speaking country,so my English is very bad,sorry...... Edited by author 10.11.2007 16:53 It's because of skipping 2. Try sqrt(10) - you won't find 5 in 3..sqrt(10) range. And you won't get 2 either. I got WA on 13 test, because sometimes lost right answers. Try test like this: input: 10 right answer: 4 If you got WA 13 try this test input: 26 output:12 If you got WA13, make 'n/=2' for even 'n' before checking other divisors and don't forget to explicitly test 3 and 4. code .... cout << "YES\n100 55 100 12\n0 70 87 0\n0 95 93 0\n93 100 66 0"; .... take WA on test #2 and code .... cout << "YES\n0 0 255 12\n0 66 91 0\n0 188 0 0\n193 66 0 0"; ... take WA on test #1. "If the problem has several solutions, you should output any of them." But answer for: YES 0 0 255 12 0 66 91 0 0 188 0 0 193 66 0 0 for test #1 (test in example) is not accepted. "Amount of any credit is an integer number between 0 and 100". Sure, your answer for test#1 is incorrect (numbers 255, 188 and 193). I sent cw-answers for all test and ccw. The result was WA1 for both. What does it mean? I sent 2 ways of right design for my tests befor it. I sent with \n and without/ Please cheak tests. i have confusing why i use set(STL). i got WA in case #1. but when i write it in normal binary search it can AC. I have modified the problem statement a little. Numbers in teacher's list can appear more than once, so you got WA. Can you write the output? Input: "500000 100000" (he-he) My answer is "571", but expected "573". :( i use gauss with choice of maximum element in columns... type is double... to get the answer i had to ceil(100000*x)/100000; got WA 5. Could anyone explain, what's the trick? for i:=1 to N do A[1,i]:=A[1,i]+A[2,i]; or for i:=1 to N do A[1,i]:=x*A[1,i]; //x<>0 or for i:=1 to N do A[1,i]:=x*A[1,i]+y*A[2,i]; //x<>0 think about. I choose minimal by absolute value element for a[i][i]. Then I perform a[j][k] -= a[i][k] * (a[j][i] / a[i][i]) this way it gives AC. Edited by author 25.07.2008 19:40 Just 122 submissions. He-he... 10 10 1 1 3 5 7 9 11 11 13 13 15 15 3 5 7 9 17 17 19 21 23 25 25 27 29 29 31 33 19 21 23 35 37 27 39 39 31 33 41 41 49 35 37 43 43 45 45 47 47 50 49 36 38 44 44 46 46 48 48 50 24 36 38 28 40 40 32 34 42 42 24 26 26 28 30 30 32 34 20 22 16 16 4 6 8 10 18 18 20 22 2 2 4 6 8 10 12 12 14 14 I had crash at test3 when I forgot to reset size of BFS array. please explain me what is meaning of this problem? I think I don't understood problem statement well and I have WA 1 :( Help Please As I understand if there is such test: 11 22 answers may be: 12 12 or 21 21 22 11 is incorrect im my opinion. but I am not sure can anybody tell me am I correct or not? Что значит "строгое чередование"? It means that, for example, sequence 1 2 1 2 1 2 1 is valid, while sequence 1 1 2 1 2 1 1 is invalid. More precise: if we put two different types of diploma into the same row, then no two diploma of the same type should be adjacent. and total number of diplomas must be odd You must know score of Ural SU Osliki and Ural SU T34 team is not simultaneously in one game. For the first team. If they play all game with draw so the winner have n-1 scores. For the second team. The best scores is all team is win in n/2 games so the second team have (n-1)/2*3 scores but if n is even so it have one game for draw. for n is even = (n-1)/2*3 + 1 for n is odd = (n-1)/2*3 *sorry for bad english Edited by author 28.10.2008 13:18 |
|