Show all threads Hide all threads Show all messages Hide all messages | tests generator | LeTim | 1369. Cockroach Race | 20 Mar 2025 11:52 | 1 | Here is a simple "bad" tests generator on C++ to test your solutions (through comparing answers with brutforce solution): const double PI = 3.14159265358979323846; mt19937 rnd; struct Point { double x, y; }; double dist(const Point& a, const Point& b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } bool check(const vector<Point>& points, const Point& p) { for (const auto& p2 : points) if (dist(p, p2) < 1e-3) return 0; return 1; } pair<vector<Point>, vector<Point>> gen_bad_test(int m = 100000, int n = 10000, double R = 10000, double r = 10) { vector<Point> cockroaches, sweets; cockroaches.reserve(m); sweets.reserve(n); while (m--) { Point p; do { double a = uniform_real_distribution<double>(0, 2*PI)(rnd); p = {cos(a) * R, sin(a) * R}; } while (!check(cockroaches, p)); cockroaches.emplace_back(p); } while (n--) { Point p; do { double a = uniform_real_distribution<double>(0, 2*PI)(rnd); double d = sqrt(uniform_real_distribution<double>(0, 1)(rnd)) * r; p = {cos(a) * d, sin(a) * d}; } while (!check(cockroaches, p)); sweets.emplace_back(p); } return {cockroaches, sweets}; } This generator uniformly distributes points-cockroaches on a circle of radius R and points-sweets inside a circle of radius r. And another generator that just distributes all points within [-MAX; MAX] along both axes: pair<vector<Point>, vector<Point>> gen_rand_test(int m = 100000, int n = 10000, double MAX = 10000) { vector<Point> cockroaches, sweets; cockroaches.reserve(m); sweets.reserve(n); auto urd = uniform_real_distribution<double>(-MAX, MAX); while (m--) { Point p; do p.x = urd(rnd), p.y = urd(rnd); while (!check(cockroaches, p)); cockroaches.emplace_back(p); } while (n--) { Point p; do p.x = urd(rnd), p.y = urd(rnd); while (!check(sweets, p)); sweets.emplace_back(p); } return {cockroaches, sweets}; } I just got AC for this problem and these two generators greatly helped me debug the solution revealing bugs and precision issues | custom input to get AC 0.483 and 1 984 KB memory (~26ms for ~2.25MB input) | Orient | 1369. Cockroach Race | 10 Apr 2018 14:35 | 1 | If there is a way to improve, let me know: #ifdef __MINGW32__ #define uputchar _putchar_nolock #define ugetchar _getchar_nolock #define ufread _fread_nolock #define funlock _unlock_file #else #define uputchar putchar_unlocked #define ugetchar getchar_unlocked #define ufread fread_unlocked #define funlock funlockfile #endif namespace { #if 1 struct { int c; int operator * () const { return c; } auto & operator ++ () { c = ugetchar(); return *this; } auto operator ++ (int) { auto prev = *this; operator ++ (); return prev; } } cursor; #else char input[(1 << 21) + (1 << 19)]; auto cursor = input; auto input_size = cursor - input; #endif inline void skip_ws() { for (;;) { switch (*++cursor) { case ' ' : case '\t' : case '\r' : case '\n' : break; default : return; } } } inline void read_input() { //std::cin.tie(nullptr); std::ios::sync_with_stdio(false); #if 0 #ifdef ONLINE_JUDGE cursor += ufread(input, sizeof(char), sizeof input, stdin); #else { const char s[] = R"(4 0 0 1 0 0 1 1 2 2 0 0 0 2)"; cursor = std::copy(s, s + sizeof s - 1, cursor); } #endif //assert(cursor < input + sizeof input); //assert(input + 0 != nullptr); input_size = cursor - input; cursor = input - 1; #endif } template< typename U > void read_uint(U & u) { static_assert(std::is_unsigned< U >::value, "!"); u = 0; for (;;) { char c = *cursor; if ((c < '0') || ('9' < c)) { break; } ++cursor; u = (u * 10) + (c - '0'); } } template< typename I > void read_int(I & i) { char sign = *cursor; switch (sign) { case '+' : case '-' : ++cursor; } std::make_unsigned_t< I > u = 0; for (;;) { char c = *cursor; if ((c < '0') || ('9' < c)) { break; } ++cursor; u = (u * 10) + (c - '0'); } i = I(u); if (sign == '-') { i = -i; } } template< typename F > void read_float(F & result) { static_assert(std::is_floating_point< F >::value, "!"); char c = *cursor; std::uint8_t significand[std::numeric_limits< F >::digits10]; auto s = significand; std::int32_t after = 0; std::int32_t before = 0; char sign = c; switch (c) { case '-' : case '+' : c = *++cursor; } [&] { bool d = false; for (;;) { switch (c) { case '.' : before = 1; break; case '0' ... '9' : { if (c != '0') { d = true; } if (0 < before) { ++before; } if (d) { *s++ = (c - '0'); if (s == significand + sizeof significand) { std::int32_t a = 0; for (;;) { switch ((c = *++cursor)) { case '0' ... '9' : ++a; break; case '.' : after = a; break; default : if ((before == 0) && (after == 0)) { after = a; } return; } } } } break; } default : if (!d) { *s++ = 0; } return; } c = *++cursor; } }(); if (0 < before) { after -= (before - 1); } std::uint32_t exponent = 0; switch (c) { case 'e' : case 'E' : { c = *++cursor; char esign = c; switch (c) { case '-' : case '+' : c = *++cursor; break; } [&] { for (;;) { switch (c) { case '0' ... '9' : exponent = (exponent * 10) + (c - '0'); break; default : { return; } } c = *++cursor; } }(); if (esign == '-') { after -= exponent; } else { after += exponent; } } } alignas(32) std::uint8_t bcd[10] = {}; std::uint32_t b = 0; do { --s; if ((b % 2) == 0) { bcd[b / 2] = *s; } else { bcd[b / 2] |= (*s << 4); } ++b; } while (s != significand); if (sign == '-') { bcd[9] = (1 << 7); } asm( "fldl2t;" "fildl %[exp10];" "fmulp;" "fld %%st;" "frndint;" "fxch;" "fsub %%st(1), %%st;" "f2xm1;" "fld1;" "faddp;" "fscale;" "fstp %%st(1);" "fbld %[tbyte];" "fmulp;" : "=t"(result) : [exp10]"m"(after), [tbyte]"m"(bcd) : "st(1)", "st(2)" ); } template< typename I > void print_int(I value) { if (value == 0) { uputchar('0'); return; } std::make_unsigned_t< I > v; if (value < 0) { uputchar('-'); v = decltype(v)(-value); } else { v = decltype(v)(value); } I rev = v; I count = 0; while ((rev % 10) == 0) { ++count; rev /= 10; } rev = 0; while (v != 0) { rev = (rev * 10) + (v % 10); v /= 10; } while (rev != 0) { uputchar("0123456789"[rev % 10]); rev /= 10; } while (0 != count) { --count; uputchar('0'); } } } | eps | Orient | 1369. Cockroach Race | 13 Feb 2018 15:32 | 4 | eps Orient 24 Jan 2018 02:03 Epsilon to compare squared distances must be exactly 1.0 / (1 << 24) (at least for M*N algo). Even 23 and 25 leads to WA. (std::numeric_limits< float >::epsilon() / 2) is absolute accuracy needed overall. You can invent twofold float-then-double algorithm to sieve bad points beforehand. For single precision algorithm part you have to use 20.1f (20 + small constant) "epsilon" to compare squared distances in case if you use <= or >= operator (say, vcmpge_oqps or vcmple_oqps instructions) and 28.2f (28 + small constant) in case of strict inequality. Surely you can invent adaptive algorithm to infer relative accuracy needed in particular test case, which takes into account max abs differences of input point coordinates. epsilon should be explicitly specified in the problem statement, it is not hard to make a test to break even simplest O(n*m) double precision solution. I totally agree. The problem should be reformulated in integers or other way to make use of arbitrary precision numbers. Also 10000*100000 is too small dimensionality to encourage participants to make submissions of O((N + M) * log(N + M)) solutions due to high constant factor of latter. Stupid algorithm with randomization and trivial vectorization is faster (and extremely easier to implement) then clever algorithm with Voronoi and point location. | asm tips | Orient | 1369. Cockroach Race | 11 Feb 2018 13:26 | 2 | Make two separate arrays for x and y coordinates of cockroaches. Don't use horizontal instructions in tight loops. Perform all the develop and debug in 32-bit mode (evidently GCC/Clang on server has -m32 key). x86-64 has RIP-relative addressing, there would be bottlneck when you go back to 32-bit build and try to backport from 64-bit one. First loop for each sweet is straitforward. Don't use `displacement(base,index,scale)` addressing. Always run all over the `base` part. Finally it may give about a couple of hundred ms. In second loop for each sweet you may use BSF instruction to get least significant bit offset (remeber, judge runs on Sandy Bridge arch). Use LEA to calculate simple index arithmetic. Here is mine: size_type R = 0; asm ( "vbroadcastsd %[dmin], %%ymm5;" "dloop:" "vcmpgt_oqpd %[d](,%[i],8), %%ymm5, %%ymm6;" "vmovmskpd %%ymm6, %%eax;" "test %%eax, %%eax;" "jz rnext;" "rloop:" "bsf %%eax, %%edx;" "lea 1(%%edx,%[i]), %%edx;" "mov %%edx, %[results](,%[R],4);" "inc %[R];" "lea -1(%%eax), %%edx;" "and %%edx, %%eax;" "jnz rloop;" "rnext:" "add $4, %[i];" "cmp %[M], %[i];" "jl dloop;" : [R]"=b"(R) : [d]"m"(d), [dmin]"m"(dmin), "0"(R), [results]"m"(results), [M]"r"(M), [i]"c"(0) : "cc", "memory", "%eax", "%edx", "%ymm5", "%ymm6" ); Custom IO gives about 300+ ms. I hope M*N solutions finally will loose their ACs someday (at least until hardware will be updated to AVX512-compatible). It turns out, that there are possible two way to solve this problem (both M*N) in addition to naïve one (1400ms). 1.) Read all sites, then for each query point do find all the preliminary neighbours using float coordinates (it is almost two time faster in terms of membory bandwitdth, then if use double). This is a "float" sieve. Then for all sites passed "float" sieve perform similar "double" sieve. It get about 500ms (for me from 1.45s to 950ms). Test #16 is still hardest. Prefetch instructions in long runs gain up to 100ms. First loop (precalc of squared float distances) can be unfolded 4 times by query points (vbroadcastss from fixed memory location works fast in loop, you should not occupy dedicated ymm register for these). Second loop, where squared distances compared against least distance (+ eps of course), found in previous loop, can be unfolded 4 times (you can occupy all 32 bit of some register using bit shift (ror, rol) after vmovmskps). I think it allow to better utilize branch prediction mechanism. This approach can be beaten by simple test: cloud of sites in one corner in 10x10 square and cloud of query points in opposite aslo in 10x10 square both in general position (not matters much). Or wiser: query points placed on quarter of circle with center in one corner and radius of 20000, sites on another quarter of circle with center in the same corner and small radius or vice versa. Or even: two distant strait lines: one with query points and another with sites. 2.) You can solve the problem in single loop using just doubles with randomization. If your random numbers hit right sites, then you can probably make even fastest solution (but it is too improbably). I can't find counterexample for this randomized approach. I am very interested in Progbeat's solution details. It seems (by memory consumed) he used approach very similar to mine. It would be great if we'll exchange our solutions somehow =). | Input precision | lxn | 1369. Cockroach Race | 21 Dec 2017 21:10 | 31 | There is a restiction for X and Y values: −10000.0 ≤ x, y ≤ 10000.0. Does .0 (sigle zero) means that only one digit after the decimal point is possible? Or if there any restriction for number of digits after the decimal point? You can check it on your own... Throw a division by zero or reach a memory limit or whatever, if you meet a number with more than one digit. If you still reach the same test, then there's no such numbers. Thanks. The 6th test have numbers with 8 digits after decimal point. In test #13 there are numbers with 21 digits after decimal point In test #13 there are numbers with 21 digits after decimal point It bothers you? Do you want to talk about it? This is a test case with only 6 digits after decimal point: 2 999.969732 999.984915 1414.181493 0 1 0 0 And it needs about 20 digitd precision to resolve it corectly, Doubles can fail on such tests. Using 21 digits it is possible to create tests which can be solved correctly using long arithmetic only. Does this problem requires to compare distances with no error, or there is an accepted tollerance? I have figured out that 1e-10 difference bewtween dx * dx + dy * dy is accepted Good job, and thanks for the valuable info! I've got accepted with O(N * M) solution. But in my main idea i use voronoi and have WA17 - there are some precision errors in voronoi building, but i hope that i can fix it ) I've got accepted with O(N * M) solution. O(N * M) for 1.762 seconds??? Is it Voronoi with following "modification": instead of binary tree you use just a linked list? N sweep line motions * M increemnts of iterator during binary search in linked list (but still log(M) parabolas' intersections)? Or something else? But in my main idea i use voronoi and have WA17 - there are some precision errors in voronoi building, but i hope that i can fix it ) What is the cause of WA? Symmetic cases (more then 3 sites on vertex?)? Is it true, that there are four cockroaches maximum may be close to each sweet piece? 1) 1.762 - is voronoi solution. O(N * M) works more than 3 seconds. There were smome implementation issues. My O(N * M) just check eahch to each with no precalcs. 2) definitely no. points (-5, 0) (-4, -3) (-3, -4) (0, -5) (3, -4) (4, -3) (4 3) (3 4) (0 5) (-3 4) (-4 3) have the same distance equal to 5 from the point (0, 0). Using a floating point values there are possible thousands of cockroaches close to some sweete pieces Edited by author 04.06.2016 15:25 If I use general precision arithmetic and algebraic numbers, then I get WA even being correct. 1) 1.762 - is voronoi solution. Can you say is the following algorithm right?: 1.) Firstly lexicographically sort all the cockroaches and all the sweet pieces. 2.) In first pass, make Voronoi for cockroaches using Fortune algorithm. Voronoi data struct is graph of vertices and edges. For each edge there are pointer to "left" site and pointer to "right" site. For each vertex there is a set of pointers to edges, which supported by this vertex. 3.) Vertices are produced by algorithm in previous step, are already sorted lexicographically (or sort them otherwise). 4.) In second pass, events are sweepings of vertices and sweepings of sweet pieces. For each edge there is bounding box. We can track appearing and lefting of bounding boxes for each edge and infer the belonging of each sweet pieces for each cell. I am very doubted with 4.). 1) 1.762 - is voronoi solution. Another possible algorithm is "inline" version of Fortune's algorithm: during sweep line motion if parabolic arc disappears, then we have a pair of edges, that meets in corresponding new vertex. Check all sweeped sweet pieces for belonging to cone, supported by this two edges. I some sweet piece is inside (or on the edge (2 cockroaches), or matches the vertex (greater then 2 number of cockroaches are closest)), then move it from list of already sweeped sweet pieces to result. 1) I think that both of this algos are incorrect. Bounding boxes of the edges is not good idea because some sweets can be out of any bounding box 2) Check all sweets when parabolic arc disappears needs to much time. There could be the sitation when all of the sweets are located in the same voronoi cell, and is is located in such place the there are a lot of cells before PS I don't that it is good idea to discuss here a correct solution. We can discuss it out of timus forum for example in vk.com (my name is Александр Пак) There are a plenty of your namesake in vk.com. It is almost impossible to distinct you from the others. to avoid decreasing precision error we can find delaunay triangulation of m points and for each n points we can first find which delaunay triangle it is in, compare these three points and its adjcent triangle. at least one of the point with minmum distance in these three triangles, if we find three point of one triangle if equal to minimum distance, continue to find its adjcent triangles. sorry for so many dumplicate post with so fucking network Edited by author 21.10.2016 14:59 to decreasing precision error we can find delaunay triangulation of m points and for each n points we can first find which delaunay triangle it is in, compare these three points and its adjcent triangle. at least one of the point with minmum distance in these three triangles, if we find three point of one triangle if equal to minimum distance, continue to find its adjcent triangles. to decreasing precision error we can find delaunay triangulation of m points and for each n points we can first find which delaunay triangle it is in, compare these three points and its adjcent triangle. at least one of the point with minmum distance in these three triangles, if we find three point of one triangle if equal to minimum distance, continue to find its adjcent triangles. to decreasing precision error we can find delaunay triangulation of m points and for each n points we can first find which delaunay triangle it is in, compare these three points and its adjcent triangle. at least one of the point with minmum distance in these three triangles, if we find three point of one triangle if equal to minimum distance, continue to find its adjcent triangles. I thought about Delanau triangulation. I have nD implementation of Quickhull algo, which can give me triangulation, when applied to projection onto paraboloid. Bit it is not too hard to imagine bad case for BFS on triangulation graph. E.g. well known concentric points. It is the same bad case as for quadtree. Edited by author 10.11.2016 18:12 Does your last solution use this algorithm? NO, my AC sol directly find voronoi diagram but when Location the point, you mustn't find the intersection point of x==x0 instead you should find the nearest Thiessen polygons directly using Euclid distance to sort it.. in a word you should use original point as much as you can to inprove your accuracy btw seems there is some clever k-d tree sol also get AC... Edited by author 20.12.2017 21:58 What do you think, are top 3 solution implemented via Voronoi? I implemented Fortune's ( https://github.com/tomilov/sweepline), but I can't overcome precision errors in case of regular grids and concentric points, even if I use a little cheating: I modify input by rotation on some small angle. Some of points became a points-in-general-positions. Then I use something like this ( http://www.link.cs.cmu.edu/15859-f07/papers/point-location.pdf), but invented by myself - it is much simplier for Voronoi diagram. I interested to talk with you (I will not bother you much), can you give any contact? Edited by author 21.12.2017 19:51you can contact me through 441766573@qq.com my qq is always online... you can contact me through 888888888@qq.com my qq is always online... You can remove the number and add me to your contacts =). | Who had a Wrong Answer in 5 th test ? What mistake may be there ? | Escarabajo | 1369. Cockroach Race | 4 Oct 2017 14:14 | 3 | Who had a Wrong Answer in 5 th test ? What mistake may be there ? Locally you can make straitforward solution M * N and check what line is wrong. as far as I remember test 5 is the case N==0, just output empty line.. | Can be the number of sweet pieces equal 0 ?? | Escarabajo | 1369. Cockroach Race | 7 Sep 2017 17:20 | 1 | Russian: Далее следуют M строк по 2 целых числа в каждой — координаты тараканов в настоящий момент. M + 2 строка содержит число ??? N (0 ≤ N ≤ 10000) ??? . Далее N строк — координаты кусочков сладости. Все координаты — действительные числа. English: M lines follow, containing 2 numbers each — these are coordinates of the cockroaches at the present moment. (M + 2)nd line of the input stream contains the number ??? N (0 ≤ N ≤ 10000) ??? . N following lines contain coordinates of sweet pieces. Can be the number of sweet pieces equal 0 ? So what will be the answer in this case ? Answer can be empty ? Edited by author 07.09.2017 17:23 Edited by author 07.09.2017 17:23 | Memory limit in java | pilosofi | 1369. Cockroach Race | 5 Sep 2017 19:33 | 3 | Can somebody tell me why i get memory limit exceeded in test case #9... ???? i make an k-d tree and use nearest neighbor search in my solution and still have memory limit Edited by author 03.05.2013 07:52 Have you done it? i have memory limit in test 10 too (c++) Have you done it? i have memory limit in test 9 too (c++) Edited by author 05.09.2017 19:58 Edited by author 05.09.2017 19:58 | Please, what kind of test in #6 test? | T_e_n_Jl_bl_u | 1369. Cockroach Race | 2 Sep 2017 05:38 | 3 | i try, but it isn't enough. give a hint, please (test #6) Edited by author 01.09.2017 07:46 What about test #9? every time Runtime error. what can be there? Edited by author 02.09.2017 05:39 | haha 1.6 s AC ,congratulation to myself>.... | Shen Yang | 1369. Cockroach Race | 6 Mar 2017 22:15 | 4 | oh yeah, nearly 1000 submits, i dont remember so I get a conclusion: I use veronoi diagram algorithm ,it will have precision error. if you sort coordinates by x, you will get WA on test 17,if you sort it by y,you will get WA on test 21.. so I combine them together, do sort them by x,then sort them by y, and compare the minimum distance, it'll get AC.. so I get a conclusion: I use veronoi diagram algorithm ,it will have precision error. if you sort coordinates by x, you will get WA on test 17,if you sort it by y,you will get WA on test 21.. so I combine them together, do sort them by x,then sort them by y, and compare the minimum distance, it'll get AC.. gz. It is called "lexicographical sorting". | Problem 1369 "Cockroach Race". Time limit decreased | Vladimir Yakovlev (USU) | 1369. Cockroach Race | 15 Jun 2016 07:37 | 18 | The new time limit for the problem id 4 seconds. With old time limit 5 seconds bruteforce solutions could pass all tests. I think time limit should be decreased down to 1 second. It is not hardest problem otherwise. My AVX solution w/o custom input/output can pass all the tests too. http://acm.timus.ru/getsubmit.aspx/6871223.cppAnother way to make this problem interesting is to change N from 10000 to 100000. AVX? :) if solution requires manual vectorization to avoid TL - it is still hard problem, but trivial (double precision) arithmetic is enough here for now. Edited by author 08.06.2016 04:43 IMO time limit should be 2 (or 3) seconds - it breaks brute force, at least for now, but still allow(?) good java solutions (best - 1.7 seconds). Simple arithmetic gives TLE 9. BTW Fortune's algorithm also implies just only trivial arithmetic (i.e. +-*/), do you mean this? No, I mean absolutely straightforward O(N*M) algorithm, 20 lines of c/++ So, I reached 1.7 seconds It is not brute force now (since there are several non-trivial optimizations), but it is still O(N*M) algorithm... It should be 1.5-2X faster when AVX512 is available. AVX (256 bit, 4 dobule) is not faster then SSE (128 bit, 2 double) on the judging system, though. Because of bus width, I think. gcc msvc 1xD: TL9 3.260 2xD: 1.981 2.308 4xD: 1.575 1.482 Edited by author 10.06.2016 12:55 I really want to see your solution! Can we trade it for top3? Edited by author 10.06.2016 22:27 Just understand what is "top3" - thank you - no, I like problem solving :) Edited by author 11.06.2016 06:44 That means problem 1548. Anyways I will to solve this problem using Voronoi. But now I just especially interested in manual vectorization technique. And SSE/AVX/AVX512 solution is just a "reference point" for "right" solution via Fortune's algorithm. Yep, I understood. Please share your email. I don't think that my solution will help you, it is based on very specific optimizations. How to improve SSE solution in such a way, that it became 2.5x faster? Very interesting optimizations should be here. Edited by author 13.06.2016 01:39 New time limit is set to 2 sec. Thanks for reporting a problem. It seems that solutions of other problems may have benefit from new hardware too. Maybe it make sense to rejudge a couple of tens of hardest problems (at least 100-200 top solutions). | How to implement this with Voronoi diagram | al13n | 1369. Cockroach Race | 31 May 2016 20:45 | 2 | Ok, I understand Fortune's algorithm for building Voronoi diagrams. But how to implement answering the nearest point queries? Can it be done without explicitly building full-featured Voronoi diagram and then using another sweeping line on it? I guess, the queries can be answered during building the diagram, without actually building the diagram. But how to generate events "a query point meets parabolic front"? Is it even possible in O(log n)? Edited by author 10.11.2016 18:14 | Precision | lxn | 1369. Cockroach Race | 31 May 2016 18:16 | 1 | I have figured out that the 6th test contains numbers with 8 digits after the decimal point. Is it the maximum alowed or are there tests with more than 8 digits after decimal point. What tollerance shouled be used to compare distances between points? It it neccessary to do it with no error or is there an accepted tollerane? I have generated several test cases with only 6 digits after decimal point, and doubles doesn't allow to resolve this tests correctly. If there are 8 digits after decimal point and 4 before, it is necessary to store about 24 digits. 1) is is necessary to compare distances between points with no error? 2) What is maximum alowed number of digits after decimal point in input? test cases: 2 999.969732 999.984915 1414.181493 0 1 0 0 >>>>> (999.969732 * 999.969732 + 999.984915 * 999.984915 == 1414.181493 * 1414.181493 == 1999909.295143709049) 2 999.856428 999.897768 1414.039753 0 1 0 0 >>>>> (999.856428 * 999.856428 + 999.897768 * 999.897768 == 1999508.423064301008 < (1414.039753 * 1414.039753 == 1999508.423064301009)) 2 999.725264 999.971561 1413.999196 0 1 0 0 >>>>> (999.725264 * 999.725264 + 999.971561 * 999.971561 == 1999393.726288646417 > (1413.999196 * 1413.999196 == 1999393.726288646416)) Edited by author 31.05.2016 18:21 | No subject | Orient | 1369. Cockroach Race | 28 Apr 2016 18:59 | 1 | Edited by author 20.12.2017 21:41 | To admins | Alex Vistyazh [Ivye School] | 1369. Cockroach Race | 10 Jan 2016 04:28 | 1 | To admins Alex Vistyazh [Ivye School] 10 Jan 2016 04:28 | Is this a valid test case? | Ade [FDU] | 1369. Cockroach Race | 28 Mar 2014 03:36 | 2 | Is this a valid test case? 2 -9999 -1 -9999 1.00000000000000000001 1 9999 0 I know the answer should be 1. But it's hard to code. Edited by author 08.03.2014 14:22 My AC program answers 1 2 I don't think doubles allow such precision. | Any ideas about test #16? (+) | Vedernikoff 'Goryinyich' Sergey (HSE: АОП) | 1369. Cockroach Race | 3 Apr 2013 21:27 | 3 | I wrote kd-tree based solution but still TL#16, and I cannot find bad cases for my realization (on my local machine it finishes within 1 sec on any test). Any ideas of what kind of tests may these be? Edited by author 26.03.2013 04:00 | No subj (-) | Vedernikoff 'Goryinyich' Sergey (HSE: АОП) | 1369. Cockroach Race | 26 Mar 2013 04:20 | 1 | No subj (-) Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 26 Mar 2013 04:20 Edited by author 26.03.2013 14:03 | Different Russian and English version: | xurshid_n | 1369. Cockroach Race | 26 May 2012 19:42 | 2 | Russian: Далее следуют M строк по 2 целых числа в каждой — координаты тараканов в настоящий момент. M + 2 строка содержит число N (0 ≤ N ≤ 10000). Далее N строк — координаты кусочков сладости. Все координаты — действительные числа. English: M lines follow, containing 2 numbers each — these are coordinates of the cockroaches at the present moment. (M + 2)nd line of the input stream contains the number N (0 ≤ N ≤ 10000). N following lines contain coordinates of sweet pieces. All coordinates are floating point numbers. i.e. are integer or float coordinates of the cockroaches ? All coordinates are floating-point numbers. Statement is fixed. Thank you. | Please, decrease time limit!!! My bruteforce solution (with trivial precalc) passed all tests with 4.953s!! | Shellkunchik | 1369. Cockroach Race | 30 Jul 2011 00:00 | 1 | Please, decrease Time Limit to 4 second (for example)! Edited by author 30.07.2011 00:01 |
|
|