Common Board| Show all threads Hide all threads Show all messages Hide all messages | | WA #9 | 10100 | 1517. Freedom of Choice | 14 Apr 2018 07:03 | 1 | WA #9 10100 14 Apr 2018 07:03 use N = 100001 instead N = 100000 | | A HINT | coder | 1798. Fire Circle. Version 2 | 13 Apr 2018 14:08 | 4 | A HINT coder 18 Jan 2018 15:49 Solution is a sum( [ sqrt(2*i*R - i^2) ], i = 1,2,...,R), where [ x ] - round to up. But, I always GOT TL on 17 test). if we notice f(i)==sqrt(2*i*R-i*i); and f(i+1)-f(i) always >=sqrt(R) we can change to count howmany i satisfy c==sqrt(2*i*R-i*i) then answer+=ways*c then this problem will be solved in O(sqrt(R)) thank you for your hint my fault but increment of f(i) seems to be monotonic decreasing and increment <=sqrt(2*r) so we can binary search and divide them to sqrt(2*r) segment with same increment and add each segment using sum of arithmetic series my fault but increment of f(i) seems to be monotonic decreasing and increment <=sqrt(2*r) so we can binary search and divide them to sqrt(2*r) segment with same increment and add each segment using sum of arithmetic series | | hint | ASK | 1983. Nectar Gathering | 12 Apr 2018 22:41 | 1 | hint ASK 12 Apr 2018 22:41 Consider 2D problem in polar coordinates: intersect disk with given radius R and center in the origin with triangle with vertexes in origin, (R1,0), and (R2,phi). Solve it using quadratic equation... Combine the algebraic sum of solutions to get the final result. Edited by author 12.04.2018 22:45 | | Rust compiler was updated to the version 1.25.0 | Vladimir Yakovlev (USU) | | 12 Apr 2018 03:07 | 1 | | | hint | ASK | 1750. Pakhom and the Gully | 11 Apr 2018 21:33 | 2 | hint ASK 11 Apr 2018 21:31 Check: SBT; SAT, SABT, SBAT, SACT; the same four with swapped A and C 33 1 2 5 6 4 4 5 2 1 6 2 2 4 3 1 3 3 3 3 1 2 1 4 4 3 2 4 3 1 4 1 1 3 3 0 2 2 2 2 0 2 2 6 1 -1 1 5 6 5 0 2 2 0 3 -1 1 5 6 5 0 2 2 -4 0 -1 1 5 6 5 0 2 2 6 7 -1 1 5 6 5 0 2 2 5 7 -1 1 4 6 5 0 1 1 6 6 2 2 3 3 4 4 1 1 6 6 2 4 3 3 4 2 1 1 2 2 -1 -1 -1 -2 -2 -1 1 1 3 3 4 6 2 2 6 4 1 1 3 3 4 6 1 2 6 4 1 1 3 3 4 6 1 2 7 4 1 1 2 2 1 3 3 3 3 1 1 1 1 5 0 8 1 2 3 2 5 2 3 5 -1 2 4 5 6 3 4 1 5 5 2 3 6 4 5 2 1 1 7 5 2 3 6 4 5 2 1 1 3 3 2 4 2 2 4 2 6 1 6 4 0 5 7 2 6 5 2 2 4 2 2 1 3 6 4 1 4 2 2 2 2 1 3 6 4 1 8 7 1 3 6 1 7 4 0 9 5 1 2 2 2 1 4 1 8 9 9 -1 3 1 0 0 7 0 3 3 1 -1 6 7 0 0 7 0 3 3 0 0 8 0 2 0 4 0 6 0 1 1 4 4 0 3 3 3 3 0 0 0 0 4 2 1 0 2 2 3 0 0 0 4 0 2 2 2 3 2 1 1 5 2 1 2 5 1 0 3 8.000000 3.650282 3.828427 4.576491 5.019765 5.398346 6.324555 10.676619 10.605551 7.071068 7.634414 1.414214 8.993230 8.993230 9.162278 1.414214 5.841619 5.242641 5.064495 7.621233 4.576491 5.576491 4.000000 4.000000 11.709720 4.000000 9.211103 10.633758 8.000000 6.359174 4.000000 4.000000 5.000000 from matplotlib.pyplot import * from math import * inp='4 2 2 2 2 1 3 6 4 1' sx,sy,tx,ty,ax,ay,bx,by,cx,cy = [float(i) for i in inp.split()] plot(sx,sy,'go') plot(tx,ty,'ro') plot([ax,bx,cx],[ay,by,cy],'bo-') def l(ax,ay,bx,by): plot([ax,bx],[ay,by], '--', label=str(sqrt((ax-bx)**2 + (ay-by)**2))) def l2(ax,ay,bx,by,cx,cy): plot([ax,bx,cx],[ay,by,cy], '--', label=str(sqrt((ax-bx)**2 + (ay-by)**2) + sqrt((cx-bx)**2 + (cy-by)**2))) def l3(ax,ay,bx,by,cx,cy,dx,dy): plot([ax,bx,cx,dx],[ay,by,cy,dy], '--', label=str(hypot(ax-bx,ay-by) + hypot(bx-cx,by-cy) + hypot(cx-dx,cy-dy))) l(sx,sy,tx,ty) l2(sx,sy,ax,ay,tx,ty) l2(sx,sy,bx,by,tx,ty) l2(sx,sy,cx,cy,tx,ty) l3(sx,sy,bx,by,ax,ay,tx,ty) l3(sx,sy,bx,by,cx,cy,tx,ty) l3(sx,sy,ax,ay,cx,cy,tx,ty) l3(sx,sy,cx,cy,ax,ay,tx,ty) axis('equal'); grid(); legend(); show() | | What we must to find ? | Alias aka Alexander Prudaev | 1722. Observation Deck | 11 Apr 2018 19:21 | 11 | I do not understand why, but my program gives different result, than sample. in this picture, i draw a figure with yellow, i think area of this figure is an answer, i am right ? download this picture: http://slil.ru/28091271Question is simple. H is not diven then we have plane problem. Two adjacent, rejion after antey+ antey itself. No subject Alias aka Alexander Prudaev 18 Oct 2009 00:40 You filled with yellow only the area behind the new building. But the big inner circle must be included in "non-seen" region as well. I think, that this problem can be solved only via integrals. Analytic geometry doesn't work. I am right? No!i tried to use integral during contest: WA8- rounding error. At the next day I found simple analytic solution. Are you sure, that it is simple solution? =) A think, that main problem is that we can't make any Circle Sector, except sector from the center of town, so we can't find exact area behind New Antey Building. Areas of figures with rounded border are hardly calculated. The figure can be decomposed into triangles and circle segments. All lengths and , therefore areas are easy calculated, typical school problem. Edited by author 18.10.2009 17:15 Solution on Java exists! No problems with accuracy of calculating. the link for the diagram has expired can anyone draw a figure and upload again, the area to find out is unclear to refer to from the question. The new tower blocks its own area plus all the town behind it. This sum needs to be divided by (pi * R**2) and multiplied by 100. | | WA on Test 7 | MirceaS | 1341. Device | 11 Apr 2018 02:08 | 2 | Does anyone know the input for test 7? If you use fmod(...,360), remember that for negative input you get negative output. | | Time limit correction for problem 1439. Battle with You-Know-Who | Vladimir Yakovlev (USU) | 1439. Battle with You-Know-Who | 10 Apr 2018 23:39 | 1 | The time limit for the problem has been corrected from 2.0 sec to 1.0 sec. The new value better reflects the original expectations for accepted solutions back from 2006. Around 40 authors have lost their AC (mostly submitted since 2017). | | so easy!! | Haloom | 1910. Titan Ruins: Hidden Entrance | 10 Apr 2018 20:49 | 1 | just print the max sum of three consecutive numbers and also the index of the middle element of the numbers. | | custom input to get AC 0.483 and 1 984 KB memory (~26ms for ~2.25MB input) | Anatoliy V Tomilov | 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'); } } } | | Java как короче? | Anton | 1000. A+B Problem | 9 Apr 2018 23:33 | 3 | import java.util.Scanner; public class A { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println(in.nextInt()+in.nextInt()); } } Много весит и долго делает, подскажите, как облегчить и ускорить? you have to declare variables and place the input there. Файлы на java не могут много весить и запускаются всегда долго | | How to solve this tusk? | 4llower | 1081. Binary Lexicographic Sequence | 9 Apr 2018 15:50 | 1 | | | Oh, the task description is so bad. | Dmitri Belous | 1350. Canteen | 9 Apr 2018 01:10 | 2 | 1. I spent nearly a half of hour to clear that "a dangerous stuff" does not mean "student may be poisoned", but "he will be poisoned exactly because of the stuff". Why not use "a harmful stuff" everywhere? 2. And these words: "The food is cooked from M different food stuffs. There are N different food stuffs in the menu but not all of them are at the distribution...". Why not write "The distribution contains M different food stuffs from the menu. The menu consists of N different stuffs."? 3. So, I've understood that the distribution does not contains the stuffs from the first block. But it took much time because of bad description. Agree... simple problem, awful problem statement. | | plot | ASK | 1444. Elephpotamus | 8 Apr 2018 22:13 | 1 | plot ASK 8 Apr 2018 22:13 if your program is /tmp/a.out and the input is /tmp/in, you can use the following Python 3 script to plot your output: from matplotlib.pyplot import * import subprocess f = open('/tmp/in') n = int(f.readline()) p = [[int(i) for i in l.split()] for l in f] print(p) out = subprocess.run('/tmp/a.out < /tmp/in', stdout=subprocess.PIPE, shell=True).stdout.decode().strip() res = [int(s) for s in out.split('\n')[1:]] print(res) plot([v[0] for v in p],[v[1] for v in p],'ro') plot([p[i-1][0] for i in res], [p[i-1][1] for i in res],'b-') axis('equal'); grid(); show() | | like 1285 | ASK | 1075. Thread in a Space | 7 Apr 2018 23:26 | 1 | If you already have solved (simpler!) "1285. Thread in a Hyperspace", just replace N=8 with N=3. | | problem | MoRZe [Lviv NU] [Timus Battle] | 1836. Babel Fish | 7 Apr 2018 21:49 | 3 | problem MoRZe [Lviv NU] [Timus Battle] 30 Apr 2011 14:20 Can surface of the water be curved? no, but a sensor shows zero if the plane crosses the side below zero | | WA#4 | Zharenkov_ssau | 1636. Penalty Time | 7 Apr 2018 12:52 | 6 | WA#4 Zharenkov_ssau 9 Jan 2009 23:04 for example: 10 10 0 0 0 0 0 0 0 0 0 0 in this test wright answer is "No chance.", but not "Dirty debug :(" Re: WA#4 DnS [Samara SAU] 10 May 2010 22:30 10 30 1 0 0 0 0 0 0 0 0 0 True answer No chance. (При равенстве штрафного времени команды сортируются по алфавиту, а значит, команда ZZZ в этом случае всё равно оказалась бы на втором месте. ) It is test 4. Re: WA#4 Minos Skistonrak 7 Apr 2018 12:52 Also, Test 5 is related with the decision of 4 test. | | Hints | Denis Koshman | 1451. Beerhouse Tale | 7 Apr 2018 01:49 | 3 | Hints Denis Koshman 14 Aug 2008 21:59 EPS=1e-8 precision for =0 comparisons is ok. Output 10 digits after decimal point is ok (6 digits gave WA41). The point to find is called Fermat point, check at mathworld.wolfram.com Yea, Fermat point.... or simple ternary search :) Outputting 6 decimal points works just fine. There is no need for epsilon tweaking: it can be solved with fractions (Python 3) except one Decimal (getcontext().prec=10) needed for sqrt(3). | | L < 100 is a lie | ASK | 1130. Nikifor's Walk | 6 Apr 2018 21:41 | 1 | | | why i get Wrong answer | Kadavr45 | 2056. Scholarship | 5 Apr 2018 22:23 | 1 | var n,i,o,c,p,x:integer; s:real; begin s:=0;p:=0; readln(n); for i:=1 to n do begin readln(o); s:=s+o; end; s:=s/n; if o = 3 then begin inc(c); writeln('None'); end; if s=5 then if (c<>1) then begin inc(p); writeln('Named');end; if s>=4.5 then if (c<>1)and (p<>1) then begin inc(x); writeln('High'); end; if (c<>1) and (p<>1) and (x<>1) then writeln('Common'); end. Edited by author 05.04.2018 22:47 |
|
|