Page 2 does anyone know what is this test? thanks n^3 is suitable for which n<=200 but pay attention to the collinear problem Edited by author 17.05.2019 14:43 И все же... Что там за набор такой? 6 0 3 0 0 3 0 0 3 1 2 2 1 answer 5 (0 0 is not) 16 15 15 16 17 17 19 18 21 19 23 75 19 16 62 13 69 10 76 7 83 4 90 1 97 -2 104 -5 111 -8 118 -11 125 answer: 10 (last 10) 13 1 1 1 1 1 1 16 62 13 69 10 76 7 83 4 90 1 97 -2 104 -5 111 -8 118 -11 125 answer: 10 (last 10 your program could get 10 in prev test and get 13 here) 8 1 1 1 1 1 1 0 0 0 0 0 0 0 0 2 2 answer 8 5 4 4 4 4 4 4 4 4 4 4 answer 5 I hope, it will help you (P.S. you can click on my nickname and write me, i with big pleasure help you) Edited by author 03.03.2017 22:18 Wrong test cases. No two rabbits are in the same point What's on test 6? help, please! #include <cstdio> #include <vector> #include <math.h> #include <cstdlib> #include <algorithm> using namespace std; double line_k(double x1, double y1, double x2, double y2) { double k = (y2 - y1)/(x2 - x1); return k; } double line_b(double x1, double y1, double x2, double y2) { double b = y2 - (y2 - y1) * x2 / (x2 - x1); return b; } bool is_on_line(double k, double b, double x, double y) { if (y <= x * k + b + 0.01 && y >= x * k + b - 0.01) return true; return false; } struct point{ double x,y; }; int main() { int n, counter = 2, max_zerosx = 0, max_zerosy = 0; double x, y, k, b; vector <point> koord; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lf %lf", &x, &y); if (x == 0) max_zerosx++; if (y == 0) max_zerosy++; { koord.push_back(point()); koord[i].x = x; koord[i].y = y; } } int maximal = max(max_zerosx, max_zerosy); for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { k = line_k(koord[i].x, koord[i].y, koord[j].x, koord[j].y); b = line_b(koord[i].x, koord[i].y, koord[j].x, koord[j].y); for (int l = j + 1; l < n; l++) if (is_on_line(k, b, koord[l].x, koord[l].y)) counter++; if (counter > maximal) maximal = counter; counter = 2; } } printf("%d", maximal); return 0; } I got WA#8 too. But my solution uses integers only. What is the test? Edited by author 24.11.2015 03:27 How do you build lines when both points have the same X? Would you rather use not y=Ax+b but Ax+By+C=0 line equation? Also I think your epsilon - 0.01 - is too big. You can to avoid float numbers at all. Edited by author 24.11.2015 14:17 Edited by author 24.11.2015 14:17 This is not problem. My solution uses only integer values (there is no any epsilon), but it crashes on the same test Thanks alot, will try this! I solved it in 0.015 with g++, but i can't optimize anymore Edited by author 22.06.2015 13:32 Not understand the algorithm. What is it? Please explain the problem. Edited by author 25.03.2012 18:41 Some new tests were added. 234 authors lost AC. Maybe we'll add more tests soon. Some more tests were added. 200 authors lost AC. Edited by author 14.12.2011 23:32 I think there is a problem here. My pascal solution has failed and WA 14 now, and it was accepted before. And my C++ solution is still AC and I have recently retyped the same Pascal solution that failed, into C++, and both codes are exactly the same, except one is C++ and the other one is Pascal. What could be the problem? Try simple test: 2 0 0 1 1 As I see from the problem statement, this test is incorrect =) You are right, this test is incorrect. :) And there is no such test in the test set. But FreezingCool's Pascal and C++ solutions give different answers on this test. The answer to this test is 2, which my program correctly gives. I received WA12. Unless the geometric formula has changed in 5 years, then the new tests could be with boundary conditions. Thank you for taking the time to answer. I find out, that test 14 requires high accuracy of comparsion of two double(float) values. I used e=0.000000001 and i got AC. Do calculations in integer numbers - and won't have troubles with precision. In my solution I read values like this: scanf("%d %d", &px[i], &py[i]); px[i] += 1000; py[i] += 1000; board[px[i]][py[i]] = 1; and get access violation on test #4; however, if I add right before accessing the array: if (px[i] < 0 || py [i] < 0 || px[i] > 2000 || py[i] > 2000) { while (1); } I get TLE on the same test. Are all the values of test #4 within the bounds -1000 <= x,y <= 1000 ?! Statement is fixed. Now -2000 <= x,y <= 2000 (as it was actually in tests). Thank you. Edited by author 11.08.2011 18:49 Page 1 What test6? please help me. Edited by author 12.05.2011 11:10 I have understood why you could have some strange WA2. my program: while (scanf("%d", &n) >= 1) { ... } if I write while (scanf("%d", &n) >= 1) { if (!n) break; ... } I'll get AC..(though n >= 2=)) they have some trash at the end of the file... only integer @Точка задаётся целочисленными координатами x и y. @ Edited by author 26.07.2010 18:54 Edited by author 26.07.2010 19:44 if (pts[m].y == (int)(Math.Round(k * (double)pts[m].x + b))) this i changed on if (Math.Abs(pts[m].y - (k * (double)pts[m].x + b))<0.000000001) and now I have AC Edited by author 08.01.2010 03:08 what's test2? my program has passed test 1 and 3 as i know thx me too who know what is test2 ??? :) try dis: input: 4 10 10 10 5 10 0 -1 -1 ouput: 3 Try any test with ansewer 2. Example: 3 4 4 3 5 0 0 output: 2 Why does N == 0 in test 2 ? An input contains an integer N (2 ≤ N ≤ 200) ... Well actually, if you know the O(n^2*logn) algorithm is simple -- using hash function which tells you for A,B and C of the line equation how many rabbits are before and just add. |
|