Common Board| Show all threads Hide all threads Show all messages Hide all messages | | 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++. | | Wrong tests here | Lock | 1014. Product of Digits | 4 Nov 2011 19:43 | 2 | My program is Accepted with int N. ))) In gcc (the C compiler) the int type has 32bit, for the 16bit version use short. Cheers Edited by author 04.11.2011 22:17 | | I don't know what's the matter | gigliolily | 1001. Reverse Root | 4 Nov 2011 06:39 | 1 | #include<stdio.h> #include<math.h> void main() {long a[i]; for(i=0;i<n;i++) scanf("%lf",&a[i]); printf("%6.4f\n%5.4f\n%13.4f\n%8.4f\n",sqrt(a[i]),sqrt(a[i+1]),sqrt(a[i+2]),sqrt(a[i+3])); } | | What's wrong? | Make_ | 1404. Easy to Hack! | 4 Nov 2011 04:32 | 1 | #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int c,m=5,b='a'; int a,k=0; while((c=getchar())!=-1) { a=(26+(c-b)-m)%26; printf("%c",a+b); m=c-b; } return 0; } i've got an WA#1... Edited by author 04.11.2011 21:08 | | test 32 | NeMo | 1378. Artificial Intelligence | 4 Nov 2011 04:19 | 2 | What is the test32? What dimensionality of the matrix? Is it square? I`m confused... I don`t understand this test I have the same problem =( | | plese help me | acm_jtc2011 | 1004. Sightseeing Trip | 4 Nov 2011 03:13 | 2 | I can not understand means of this problem . What should I do here? How are the roads? What the Constitution? Please help me there is not everyone to help me,plz Edited by author 04.11.2011 03:13 rehelp acm_jtc2011 4 Nov 2011 03:13 there is not everyone to help me ? plz............. Edited by author 04.11.2011 03:14 |
|
|