Common Board| Show all threads Hide all threads Show all messages Hide all messages | | WA #14 | DarkJedi | 1821. Biathlon | 6 Nov 2011 13:29 | 1 | WA #14 DarkJedi 6 Nov 2011 13:29 Edited by author 06.11.2011 20:58 | | TEST#4 | Fedor Faustov | 1005. Stone Pile | 6 Nov 2011 11:14 | 1 | TEST#4 Fedor Faustov 6 Nov 2011 11:14 Somebody, give me the test4, please! | | can anyone give me some tests | Edric Mao | 1281. River Basin | 6 Nov 2011 10:42 | 2 | | | Here is Hint to solve | Anupam Ghosh, Wipro Technologies | 1712. Cipher Grille | 6 Nov 2011 04:52 | 1 | 1.find out the equtaion, to get next location of new character after rotation each time. 2.sort the locations on basis of height. 3. print the characters on those locations. All the best. Regards Anupam Edited by author 06.11.2011 04:53 | | Why my program got WA? | Li Ruizhe | 1111. Squares | 6 Nov 2011 01:46 | 16 | It's my program: {$N+} Program p1111; Type TPoint=Record x,y:Double; End; Var Point:Array[1..100,1..2] Of TPoint; Len:Array[1..100] Of Double; num:Array[1..100] Of Integer; n:Integer; po:TPoint; Procedure Other(p1,p2:TPoint;Var p3,p4:TPoint); Var m,n:Double; po:TPoint; Begin po.x:=(p1.x+p2.x)/2; po.y:=(p1.y+p2.y)/2; n:=p1.x-po.x;m:=p1.y-po.y; p3.x:=m;p3.y:=-n; p4.x:=-p3.x;p4.y:=n; p3.x:=p3.x+po.x;p3.y:=p3.y+po.y; p4.x:=p4.x+po.x;p4.y:=p4.y+po.y; End; Procedure Init; Var i:Integer; Begin {$IFNDEF ONLINE_JUDGE} Assign(Input,'1111.Txt'); Reset(Input); {$ENDIF} Readln(n); For i:=1 To n Do Readln(Point[i,1].x,Point[i,1].y, Point[i,2].x,Point[i,2].y); Readln(po.x,po.y); End; Procedure Main; Var i,j,k:Integer; p:Array[1..5] Of TPoint; u,A,B,C,L1,L2,L3,q1,q2,S:Double; Begin For i:=1 To n Do Begin num[i]:=i; p[1]:=Point[i,1]; p[3]:=Point[i,2]; Other(p[1],p[3],p[2],p[4]); p[5]:=p[1]; L1:=sqr(p[1].x-p[2].x)+sqr(p[1].y-p[2].y); If Abs(L1)<1e-14 Then Begin Len[i]:=sqr(po.x-p[1].x)+sqr(po.y-p[1].y); Continue; End; S:=0; For j:=1 To 4 Do Begin q1:=sqrt(sqr(po.x-p[j].x)+sqr(po.y-p[j].y)); q2:=sqrt(sqr(po.x-p[j+1].x)+sqr(po.y-p[j+1].y)); u:=(q1+q2+sqrt(L1))/2; S:=S+sqrt(u*(u-q1)*(u-q2)*(u-sqrt(L1))); End; If Abs(S-L1)<1e-14 Then Begin Len[i]:=0; Continue; End; S:=1e300; For j:=1 To 4 Do Begin A:=p[j+1].y-p[j].y; B:=p[j].x-p[j+1].x; C:=-A*p[j].x-B*p[j].y; L2:=sqr(p[j].x-po.x)+sqr(p[j].y-po.y); L3:=sqr(p[j+1].x-po.x)+sqr(p[j+1].y-po.y); If not((L1+L3-L2<0)or(L1+L2-L3<0)) Then Begin u:=Sqr(A*po.x+B*po.y+C)/(A*A+B*B); If u<S Then S:=u; End; End; For j:=1 To 4 Do Begin u:=Sqr(po.x-p[j].x)+Sqr(po.y-p[j].y); If u<S Then S:=u; End; Len[i]:=S; End; For i:=1 To n-1 Do For j:=i+1 To n Do If Len[i]>Len[j] Then Begin S:=Len[i]; Len[i]:=Len[j]; Len[j]:=s; k:=num[i]; num[i]:=num[j]; num[j]:=k; End; For i:=1 To n-1 Do Write(num[i],' '); Writeln(num[n]); End; Begin Init; Main; End. 12 -797 -6314 -2827 9400 6599 8354 -1698 -9262 -4367 4707 -6819 -3456 -9081 -1597 -2034 -8071 -5344 -1294 5374 7391 8886 -1433 8797 8123 5755 4629 6117 1844 -9568 -9375 413 -8893 6399 2576 -235 1017 -2189 9272 3306 -1693 8554 -3590 5752 2674 2770 7881 -2439 -3635 2627 2931 the answer of my program is 1 2 5 9 10 12 6 7 11 3 4 8 This is my answer: 2 5 10 12 9 7 11 1 6 4 3 8 The particular answers of my program: The distance of point 1 is: 0.0 The distance of point 2 is: 3758.8820637 The distance of point 3 is: 5317.7131577 The distance of point 4 is: 6516.753678 The distance of point 5 is: 2267.2803272 The distance of point 6 is: 1483.260766 The distance of point 7 is: 1920.5396377 The distance of point 8 is: 10242.585389 The distance of point 9 is: 1425.1471184 The distance of point 10 is:2102.5891829 The distance of point 11 is:3011.0680172 The distance of point 12 is:1880.3884245 I wonder if I'm wrong, could anybody tell me please? my out is this 1: 0.000000 2: 0.000000 3: 5317.713158 4: 6516.753678 5: 0.000000 6: 1483.260766 7: 1920.539638 8: 10242.585389 9: 0.000000 10: 0.000000 11: 3011.068017 12: 0.000000 adove is for debug! 1 2 5 9 10 12 6 7 11 3 4 8 but i still wrong answer 3 #3 ERROR ALL THE SAME 1: 0.000000 2: 0.000000 3: 5317.713158 4: 6516.753678 5: 0.000000 6: 1483.260766 7: 1920.539638 8: 10242.585389 9: 0.000000 10: 0.000000 11: 3011.068017 12: 0.000000 1 2 5 9 10 12 6 7 11 3 4 8 right answer for test 12 -797 -6314 -2827 9400 6599 8354 -1698 -9262 -4367 4707 -6819 -3456 -9081 -1597 -2034 -8071 -5344 -1294 5374 7391 8886 -1433 8797 8123 5755 4629 6117 1844 -9568 -9375 413 -8893 6399 2576 -235 1017 -2189 9272 3306 -1693 8554 -3590 5752 2674 2770 7881 -2439 -3635 2627 2931 is #1: 0.000000000 #2: 0.000000000 #3: 5317.713157659 #4: 6516.753678021 #5: 0.000000000 #6: 1483.260766015 #7: 1920.539637706 #8: 10242.585388968 #9: 0.000000000 #10: 0.000000000 #11: 3011.068017185 #12: 0.000000000 1 2 5 9 10 12 6 7 11 3 4 8 But these coordinates do not specify a square. Taking the 1st test case, how is (-797,-6314) (-2827,9400) opposite vertexes of a square ? The sides of square may be not parallel to the axes. The test and the results were quite helpful I also managed to debug my problem with them thanks guys! And also an interesting thing is that my mistake is so stupid that no one else could have done it and still I failed the 3rd test. So I think it is quite complicated and just caches all possible bugs(as I looked trough the results of the submits only one managed to fail a test with higher number). Here is an another task try to pass the 3rd and still fail a test. If you wa 3 please check your sort algorithm! Ты не мог бы помоч мне решить задачу №1028? Расказать способы решения за логарифмическое время... Мой е-мэйл: lexus_ua@list.ru Спасибо. Please use english, it is a common rule here. BTW, in case you don't know this - shitty.Mishka is my former login here. Edited by author 26.10.2004 21:13 Edited by author 26.10.2004 21:14 Thanks very much for helping me. With the help of this Testcase, I got ACed. PS: To all persons who haven't got ACed yet: Pay Attention to the Precision, please... Only 1e-14 is Enough. Otherwise you will be wrong. And, the most important one hint is: when you calculate the Side Length of a Square, your Precision would be only Sqrt(1e-14)=1e-7, that would work!!! I hope that my hint can help some people. At last, sorry for my poor English(I am Chinese). Good luck! My program is quite complexive, it works with any rectangle, not only a square. And the most interesting feature - i haven't used epsilon at all! That means, in this problem precision of extended type in Pascal is enough to solve it | | WA #6 | OZone3 | 1179. Numbers in Text | 6 Nov 2011 00:17 | 3 | WA #6 OZone3 1 Jul 2009 19:06 I've solved this task twice, first under "OZone", then under "OZone2" account. (I've lost their passwords). Now I am using the same solution (as far as I remember) and get WA #6. Could anybody give me an idea what aspect of a problem does the test #6 examine? Or is there is a way to get accounts back without emailing, because both e-mails are dead. Edited by author 01.07.2009 19:09 just write not for(k = 2;k < 36;++k) =>> for(k = 2;k <= 36;++k) Try some tests with more than one space or empty line.. and for WA7 try this: ZZ (answer is 36 1) | | If you got WA#3 | TheDreamCatcher | 1001. Reverse Root | 5 Nov 2011 20:28 | 3 | Try this test (16th of "9"): 9999999999999999 you should get 99999999,9999 in C++ cout and printf got 100000000.0000 Why is 99999999,9999 if we have ,999999... after point. We should round to 100000000.0000 according to rules of a rounding off of numbers Yes, I absolutely agree with you | | teach newfag, plz | Fedor Faustov | 1001. Reverse Root | 5 Nov 2011 20:20 | 2 | uses SysUtils; procedure RSqrt(k: Integer); var n: real; output: real; begin k:=k+1; Read(n); if n = -1 then exit; output:=Sqrt(n); if k > 0 then RSqrt(k-1); Writeln(output:0:4); end; begin while not SeekEof do RSqrt(0); end. //------------------------------------------ Well, can anybody tell me why it doesn't work? Perhaps, because of this
if n = -1 then exit; Please, don't tell me smth like "go on reading FAQ" or "use your 'while not seekeof do'." Can you just explain my mistake in this code? You know, technically, my program is working right! And yes, I got "crashed (stack overflow)" Edited by author 05.11.2011 20:20 | | WHATS WRONG WITH THIS CODE? | Levan Ilashvili | 1496. Spammer | 5 Nov 2011 19:30 | 4 | var n,i,j:byte; s:array[1..100]of string[31]; begin readln(n); for i:=1 to n do begin readln(s[i]); for j:=1 to i-1 do if s[i]=s[j] then writeln(s[i]); end; end. ______________________________ HELP PLZ try test from example )))) your program writes something like this abikbaev abikbaev abikbaev x it is just fun) Edited by author 23.11.2007 00:51 Please, can you give accepted code? I did not understand this program. | | What does this problem mean? | Failed Peter | 1278. “… Connecting People” | 5 Nov 2011 19:02 | 3 | See how it works (sample input 2): These are memory cells: 0:CALL 3 1:CALL 3 2:CALL 3 3:BELL&RET Before operatons stack is empty First the first command is executed. Stack becomes (1),IP-3 BELL&RET is executed. Then IP pop-ups to 1 (from stack). The second command is executed. Stack becomes (2) and so on. The result is 4 executed commands 'BELL&RET' | | Need Clarification! | Lebedev_Nicolay[Ivanovo SPU] | 1277. Cops and Thieves | 5 Nov 2011 18:44 | 3 | Can anybody expalain me this problem? I think that in both samples answer is YES, because all vertices are next to refuge or to museum. At last I've solved it. what about solution: 1) for maxflow use RelabelToFront 2) WA 36 : try this test 5 3 2 2 3 1 2 3 1 2 2 3 answer: NO 3) WA 38: test 5 3 2 2 2 1 2 3 1 2 2 3 answer: NO | | No subject | ONU_1785 | 1133. Fibonacci Sequence | 5 Nov 2011 17:58 | 1 | Edited by author 06.11.2011 01:51 | | Test 3 and 14 | DarkJedi | 1821. Biathlon | 5 Nov 2011 16:47 | 1 | Give test for 3 and 14 please( | | What input in test 4 ? | Ananas | 1005. Stone Pile | 5 Nov 2011 16:23 | 1 | please, tell me what input in test 4? | | Problem 1303 "Minimal coverage" has been rejudged (+) | Vladimir Yakovlev (USU) | 1303. Minimal Coverage | 5 Nov 2011 13:31 | 2 | New tests were added, memory limit was increased to 2 MB. Some people got AC, WA or Crash after MLE, some WA and Crash after AC, some Crash after AC, etc. More tests were added. 68 authors lost AC. Edited by author 05.11.2011 15:09 | | The graph can be not connected ?! | Vladislav | 1040. Airline Company | 5 Nov 2011 12:40 | 2 | When I make my algo work for not connected graphs, i got AC. (I changed dfs(0) to for(int i=0;i<n;++i)if(!lev[i])dfs(i); ) | | It's fun...I have got AC but... | vilvler | 1126. Magnetic Storms | 5 Nov 2011 03:45 | 3 | Here my solution. In c[x] I store how much I have elements with key x in set. So it is in this range M ≤ N ≤ 25000. But when I set size of c to 25000 I have got Crash on 4 test. What is wrong in my solution? #include <stdio.h> #include <vector> #include <set> #include <stdlib.h> #include <algorithm> int main(){ /*freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);*/ int m,b,c[200000],l,r,d; std::vector <int> a; std::set <int> set; std::set <int>::iterator it; memset(c,0,sizeof(c)); scanf("%d",&m); scanf("%d",&b); while (b!=-1){ a.push_back(b); scanf("%d",&b); } d=a.size(); for (int i=0; i<std::min(m,d); i++){ set.insert(a[i]); c[a[i]]++; } if (m-1<d && m!=0){ l=0; r=m-1; while (r<d-1){ it=set.end(); it--; printf("%d\n",*it); r++; c[a[r]]++; set.insert(a[r]); c[a[l]]--; if (c[a[l]]==0) set.erase(a[l]); l++; } } if (set.size()>0){ it=set.end(); it--; printf("%d\n",*it); }else{printf("0");} // fclose(stdin); fclose(stdout); } Edited by author 05.11.2011 03:44 Hello, as far as I see, you index C with values from A, which can contain numbers from 0 to 100000. Edited by author 05.11.2011 23:20 | | An algorythm?(+) | Илья Гофман (Ilya Gofman) | 1230. Introspective Program | 5 Nov 2011 03:43 | 6 | Please, could you shortly tell me an algo of a introspective program? In any language:-) Here is my variant of an introspective program. It is written on Pascal. I think it will not be hard to convert it to C/C++ But I do not think it is easy make same under PIBAS, because PIBAS does not have for/while cycles :(. Some explanations: 1. Every const string (Stgs[ 2] := '...') Has " symbol not ' because Pascal needs doubled '' to mark single ' inside strings. 2. Chr(34) = ' 3. Chr(39) = " ----- Cut here ----- program IntrospectiveProgram; var Stgs: array[1..20] of String; i, j: Integer; begin Stgs[ 1] := ''; Stgs[ 2] := ' WriteLn("program IntrospectiveProgram;");'; Stgs[ 3] := ' WriteLn("var");'; Stgs[ 4] := ' WriteLn(" Stgs: array[1..20] of String;");'; Stgs[ 5] := ' WriteLn(" i, j: Integer;");'; Stgs[ 6] := ' WriteLn;'; Stgs[ 7] := ' WriteLn("begin");'; Stgs[ 8] := ''; Stgs[ 9] := ' for i := 1 to 20 do'; Stgs[10] := ' WriteLn(" Stgs[",i:2,"] := """, Stgs [i], """;");'; Stgs[11] := ' WriteLn;'; Stgs[12] := ''; Stgs[13] := ' for i := 1 to 20 do'; Stgs[14] := ' for j := 1 to Length(Stgs[i]) do'; Stgs[15] := ' if Stgs[i][j] = Chr(34) then'; Stgs[16] := ' Stgs[i][j] := Chr(39);'; Stgs[17] := ''; Stgs[18] := ' for i := 1 to 20 do'; Stgs[19] := ' WriteLn(Stgs[i]);'; Stgs[20] := 'end.'; WriteLn('program IntrospectiveProgram;'); WriteLn('var'); WriteLn(' Stgs: array[1..20] of String;'); WriteLn(' i, j: Integer;'); WriteLn; WriteLn('begin'); for i := 1 to 20 do WriteLn(' Stgs[',i:2,'] := ''', Stgs[i], ''';'); WriteLn; for i := 1 to 20 do for j := 1 to Length(Stgs[i]) do if Stgs[i][j] = Chr(34) then Stgs[i][j] := Chr(39); for i := 1 to 20 do WriteLn(Stgs[i]); end. ---- And here ---- > Here is my variant of an introspective program. It is written on > Pascal. I think it will not be hard to convert it to C/C++ > But I do not think it is easy make same under PIBAS, because > PIBAS does not have for/while cycles :(. > > Some explanations: > 1. Every const string (Stgs[ 2] := '...') Has " symbol not ' > because Pascal needs doubled '' to mark single ' inside strings. > 2. Chr(34) = ' > 3. Chr(39) = " > > ----- Cut here ----- > program IntrospectiveProgram; > var > Stgs: array[1..20] of String; > i, j: Integer; > > begin > Stgs[ 1] := ''; > Stgs[ 2] := ' WriteLn("program IntrospectiveProgram;");'; > Stgs[ 3] := ' WriteLn("var");'; > Stgs[ 4] := ' WriteLn(" Stgs: array[1..20] of String;");'; > Stgs[ 5] := ' WriteLn(" i, j: Integer;");'; > Stgs[ 6] := ' WriteLn;'; > Stgs[ 7] := ' WriteLn("begin");'; > Stgs[ 8] := ''; > Stgs[ 9] := ' for i := 1 to 20 do'; > Stgs[10] := ' WriteLn(" Stgs[",i:2,"] := """, Stgs > [i], """;");'; > Stgs[11] := ' WriteLn;'; > Stgs[12] := ''; > Stgs[13] := ' for i := 1 to 20 do'; > Stgs[14] := ' for j := 1 to Length(Stgs[i]) do'; > Stgs[15] := ' if Stgs[i][j] = Chr(34) then'; > Stgs[16] := ' Stgs[i][j] := Chr(39);'; > Stgs[17] := ''; > Stgs[18] := ' for i := 1 to 20 do'; > Stgs[19] := ' WriteLn(Stgs[i]);'; > Stgs[20] := 'end.'; > > > WriteLn('program IntrospectiveProgram;'); > WriteLn('var'); > WriteLn(' Stgs: array[1..20] of String;'); > WriteLn(' i, j: Integer;'); > WriteLn; > WriteLn('begin'); > > for i := 1 to 20 do > WriteLn(' Stgs[',i:2,'] := ''', Stgs[i], ''';'); > WriteLn; > > for i := 1 to 20 do > for j := 1 to Length(Stgs[i]) do > if Stgs[i][j] = Chr(34) then > Stgs[i][j] := Chr(39); > > for i := 1 to 20 do > WriteLn(Stgs[i]); > end. > ---- And here ---- char *f = "char *f = %c%s%c; void main(){printf(f, 34, f, 34, 10);%c" void main() { printf(f, 34, f, 34, 10); } The main point of my solution is, firstly, to become free of constant non-variable strings in output and, secondly, to use substring operator to replicate print. Let's define double quote as D, and single quote as S, sembol of endline as E: {{{ D='"';S="'";E=";" }}} After defining that, we need to print that string. Let's use support string C: {{{ C="C=D=S=E="; ... ?$(C,1,2)+D+C+D+E #printed definition of C +$(C,3,2)+S+D+S+E #printed definition of D ... #print the rest alike }}} But how we'll print this particular "?" operation? Let's append all that operator body to our support string C, and then print it's substring, which will represent needed operator: {{{ C="C=D=S=E=?$(C,1,2)+D+C+D+E+$(C,3,2)+S+D+S+E+$(C,5,2)+D+S+D+E+$(C,7,2)+D+E+D+E+$(C,9,78)"; }}} You can simply prove by yourself, that this substring is 78 symbols long. Thus, solution found. My full PIBAS code is 187 lines long. Edited by author 05.11.2011 03:44 Edited by author 05.11.2011 03:44 | | Let's make is shorter! | .Net, Java - any pcode sucks | 1230. Introspective Program | 5 Nov 2011 03:29 | 4 | My PIBAS-program consists of 219 letters. Please, if you have shorter, share your program with me! My PIBAS Introspective program is 99 bytes long. My own solution is 89 chars long. The best known solution is 65 chars long. As for me, i've got OK for 187 chars in code | | If you have WA1 on C++ | _-Re@l-_ | 1446. Sorting Hat | 4 Nov 2011 23:23 | 1 | If you have WA1 on C++, it means that you are doing input not right. In that case I recommend you to decide this problem on Pascal - I haven't problems with input such I have in C++. |
|
|