Common Board| Show all threads Hide all threads Show all messages Hide all messages | | Test 12. Is it correct? | Burunduk1 | 1438. Time Limit Exceeded | 24 Dec 2008 22:50 | 7 | There are two labels in one string! For each string S of input I used the following checking procedure: n:=0; for p1:=1 to length(S) do inc(n,ord(S[p1]=':')); if n>1 then halt(1); But my program is still AC. It means that there is no string with two or more ':' inside. Could you explain what does "two labels in one string" mean? You might give an example of such incorrect string. S = Str, ff = 0; lmn: sscanf(S, "%s", Lab); if (Lab[(len = strlen(Lab)) - 1] == ':') { if (ff) while (1); Low(Lab); Lab[len - 1] = 0; if ((i = GetObj(Lab)) == -1) AddObj(Lab, ComN); else ObjVal[i] = ComN; S += len; ff = 1; goto lmn; } Gets TLE 12, but without "if (ff) while (1);" it gets AC. PS: without "goto lmn;" it gets WA 12. Edited by author 04.06.2006 23:42 Your code reads one label twice! sscanf(S, "%s", Lab) skips spaces in the beginning of line, but S+=len doesn't skip. Thank you :) PS: I repeat this bug again and again :( Test 12: labels after the last command. Like this: a = 1 label: | | No subject | Yevgeniy | 1572. Yekaterinozavodsk Great Well | 24 Dec 2008 21:44 | 4 | Почему в тесте 1 ответ 2. Well the answer is obviously 1. Apperently the authors of the problem lack the practical experience of putting things into holes :) But we could gratiously pardon them. After all they provided a clear example that allows us to get some insight of their understanding of the "putting things into holes" business. So we were provided with the opportunity to get this AC :) Probablty because stuff is rotated in SPACE :) Pascal AC Prog:) var a,t,n,i,k:integer; max:real; min:array[1..100] of real; begin readln(t,a); case t of 1: max:=2*a; {circle} 2: max:=a*sqrt(2); {rectangle} 3: max:=a; {triangle} end; readln(n); for i:=1 to n do begin readln(t,a); case t of 1: min[i]:=2*a; 2: min[i]:=a; 3: min[i]:=a*sqrt(3)/2; end; end; for i:=1 to n do if min[i]<=max then inc(k); writeln(k); end. | | the tallest | Viktor | 1656. Far Away Kingdom's Army | 24 Dec 2008 15:33 | 6 | is there only one TALLES soldier or there can me more of them The answer 170 170 170 is alse right to the example. right? 175 180 175 170 175 175 170 175 170 170 180 175 170 175 175 Is this standing wrong? Tell please! I think there are no errors here but the example in the task is another. | | Why WA on test 24 ?? | I_want_to_be_The_Best | 1299. Psylonians | 24 Dec 2008 11:26 | 2 | hello .this is my programm #include<stdio.h> //#include<conio.h> #include<math.h> // long energy,armor; long kol_vrag,sr_energy_vrag,ugol; long kol_robot,sr_energy_robot; long ugol_otklona; //------------------------ void Input(void); void DG(void); void DD(void); void DA(void); void DP(void); int Min(const long x,const long y); void Back(void); void Atak(void); //------------------------ void main(void) { //clrscr(); // Input(); // //getch(); } //------------------------ void Input(void) { char vid; // scanf("%ld",&energy); scanf("%ld",&armor); // scanf("%c",&vid); scanf("%c",&vid); scanf("%ld",&kol_vrag); scanf("%ld",&sr_energy_vrag); scanf("%ld",&ugol); // switch(vid){ case 'G':DG();break; case 'D':DD();break; case 'A':DA();break; case 'P':DP();break; } } // void DG(void) { if(!kol_vrag) printf("STOP"); else if(abs(ugol)<5) printf("FIRE %d",Min(20,armor)); else { if(ugol>=5) printf("LEFT %d",Min(100,energy)); else if(ugol<=(-5)) printf("RIGHT %d",Min(100,energy)); } } // void DD(void) { if((20*kol_vrag)>=armor) Back(); else DG(); } // void DA(void) { scanf("%ld",&kol_robot); scanf("%ld",&sr_energy_robot); // if((kol_robot*sr_energy_robot)>(kol_vrag*sr_energy_vrag*3)) Atak(); else Back(); } // void DP(void) { scanf("%ld",&ugol_otklona); // if(kol_vrag) DD(); else if((abs(ugol_otklona)>20)&&(abs(ugol_otklona)<160)){ if( ( (ugol_otklona>20)&&(ugol_otklona<=(90) ))|| ((ugol_otklona<=-90)&&(ugol_otklona>-160) ) ) printf("LEFT %d",Min(100,energy)); else printf("RIGHT %d",Min(100,energy)); } else printf("FRONT %d",Min(100,energy)); } // int Min(const long x,const long y) { int r=x; // if(y<r) r=y; // return(r); } // void Back(void) { if(abs(ugol)<5) printf("FIRE %d",Min(20,armor)); else printf("BACKWARD %d",Min(100,energy)); } // void Atak(void) { if(abs(ugol)<10) printf("FIRE %d",Min(20,armor)); else printf("FRONT %d",Min(100,energy)); } Test 24: Patrolling, no enemies, angle to the next waypoint <= -160. Test 27: Patrolling, no enemies, angle to the next waypoint >= 160. Answer for both tests BACKWARD. | | I got WA on 28 test 1299. What a trick? | ANDRIY BUDAY [Lviv NU] | 1299. Psylonians | 24 Dec 2008 11:23 | 3 | Edited by author 06.02.2007 05:29 Test 28: Patrolling, no enemies, angle to the next waypoint 159. Test 29: Patrolling, no enemies, angle to the next waypoint -159. | | Weak tests or checker | Fyodor Menshikov | 1226. esreveR redrO | 24 Dec 2008 01:41 | 2 | The problem statement says that a word may be followed by the end of file. So it is possible that the last line of a test is not followed by "end of line" character (or character sequence). I know AC solution that outputs end of line after each line of output. Its behaviour contradicts to phrase in the statement '"reversing" the text twice restores the original text'. I think that text with end of line before end of file and text without end of line before end of file are two different ones. So solution inserting extra end of line (when last line does not have one) should not get AC. If you have some good tests, please, write to timus_support(at)acm.timus.ru | | If you get WA #4 take a look | Seyyed Mehran Kholdi | 1039. Anniversary Party | 24 Dec 2008 01:08 | 1 | | | AC solutions | Fyodor Menshikov | 1226. esreveR redrO | 23 Dec 2008 18:38 | 1 | | | 2 Admins | OpenGL | 1384. Goat in the Garden 4 | 23 Dec 2008 18:26 | 2 | Извиняюсь, что на русском, но английский знаю плохо. В условии задачи на русском языке ошибка - "Тёмыч выгуливает своего любимого козла..." и "...число R — длину веревки, на которую Вася привяжет козла..." | | No subject | Narek Saribekyan | | 23 Dec 2008 14:27 | 3 | #include <stdio.h> #pragma warning (disable:4996) #define min(a, b) ((a)<(b)?(a):(b)) int d[1001]; int main() { int n, i, j; scanf("%d", &n); d[1] = 0; d[2] = 1; for (i = 3; i <= n; i++) { d[i] = 999999; for (j = 1; j < i; j++) d[i] = min(d[i],d[j] + d[i-j] + 1); for (j = 2; j < i; j++) if (i % j == 0) d[i] = min(d[i], d[i/j] + d[j]); } printf("%d\n", d[n]); return 0; } #include<iostream.h> int max1(int *x,int *y,int i,int j) { int k,m1=0,r=-1;bool p=true; for(k=i+1;k<=j&&p&&r==-1;k++) if(x[k]>=x[i]) { m1=y[k]; r=k; p=false; } if(r!=-1){ for(k=r;k<=j;k++) if(x[k]>=x[i] && y[k]>=m1) m1=y[k];
return m1+1; } return -1; } int main() { int n,a[1005],i,l[1005],max; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; l[n]=1; if(a[n-1]>a[n]) l[n-1]=1; else l[n-1]=2; for(i=n-2;i>=1;i--) l[i]=max1(a,l,i,n); max=l[1]; for(i=2;i<=n;i++) if(l[i]>max) max=l[i]; cout<<max; return 0; } #include<iostream.h> int f(int k,int c,char *s) { if(k==0&&c==0) return 1; else if(k==0&&c>0) return 0; else if(k>=0 && c==-1) return 0; else { if(s[k]=='(') return f(k-1,c-1,s); else if(s[k]==')') return f(k-1,c+1,s); else if(s[k]=='?') return f(k-1,c-1,s)+f(k-1,c+1,s); } } int main() { int n,i=1; char s[1000]; while(cin>>s[i]) { i++; } cout<<f(i-1,0,s); return 0; } | | No subject | Narek Saribekyan | | 23 Dec 2008 14:17 | 1 | #include <stdio.h> #pragma warning (disable:4996) int a[1000]; int d[1000]; int main() { int n, i, j, ans; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", a+i); d[0] = 1; for (i = 1; i < n; i++) { d[i] = 1; for (j = 0; j < n; j++) if (a[j] < a[i]) if (d[j] + 1 > d[i]) d[i] = d[j]+1; } ans = 1; for (i = 0; i < n; i++) if (d[i] > ans) ans = d[i]; printf("%d\n", ans); return 0; } | | what is test case 6? | demo | 1666. Vasya Ferrari | 23 Dec 2008 13:52 | 5 | I got too many wa on it.. I got WA, too. Can you tell me this case ? Got it. Here is the case that helped me: 9998 -20000 0 0 Result: (x)(x)(x-2)(x+10000) Edited by author 23.12.2008 13:51 #include<iostream.h> int max1(int *x,int *y,int i,int j) { int k,m1=0,r=-1;bool p=true; for(k=i+1;k<=j&&p&&r==-1;k++) if(x[k]>=x[i]) { m1=y[k]; r=k; p=false; } if(r!=-1){ for(k=r;k<=j;k++) if(x[k]>=x[i] && y[k]>=m1) m1=y[k];
return m1+1; } return -1; } int main() { int n,a[1005],i,l[1005],max; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; l[n]=1; if(a[n-1]>a[n]) l[n-1]=1; else l[n-1]=2; for(i=n-2;i>=1;i--) l[i]=max1(a,l,i,n); max=l[1]; for(i=2;i<=n;i++) if(l[i]>max) max=l[i]; cout<<max; return 0; } | | unfair | lian lian | 1403. Courier | 23 Dec 2008 05:28 | 1 | unfair lian lian 23 Dec 2008 05:28 The subject test data is too strange I input: 6 1 10 1 12 2 14 2 23 5 17 5 18 output: 4 3 4 6 5 test is wa#15 I change algorithm , input again output 4 3 4 5 6 test is wa #9 but I think both the result are all right, why? Edited by author 23.12.2008 05:33 | | Smb! give me some tests,please! | soloviyova_ssau | 1665. Dean's Financial Pyramid | 23 Dec 2008 01:18 | 1 | | | TO ADMINS!!! - Importatnt statement missing! | Armen Tsirunyan | 1216. Two Pawns and One King | 22 Dec 2008 21:36 | 2 | Dear Admins, don't you think that it would be prudent to state(or at least give a little hint), that WHITE IS TO MOVE FIRST?!!! Or is it so self-evident?! Thank you. | | In Test 8, N is approximately 90000 and there is answer. | Madiyar Tursunbayev | 1423. String Tale | 22 Dec 2008 21:05 | 1 | | | TLE #17 | Mat Bi | 1244. Gentlemen | 22 Dec 2008 17:50 | 1 | I got Time limit exceeded in test 17. Can you tell me the reason ??? | | To all people who want to solve it! | SPb SU White Dragon | 1224. Spiral | 22 Dec 2008 17:06 | 3 | The numbers in input files (in tests) are not integer, but real! But all numbers are in range 1..2^31 - 1 > The numbers in input files (in tests) are not integer, but real! > But all numbers are in range 1..2^31 - 1 I did it with using long long; | | WA#6 :( | RockBeat | 1216. Two Pawns and One King | 22 Dec 2008 03:04 | 2 | My prog passes all 307 tests from the forum and gets WA6, help me please... ) I had the same problem. I was inputting data as follows. char x, y; cin>>x>>y; WhitePawn.x = x-'a'+1; WhitePawn.y = y-'0'; What I should have done was char x; int y; cin>>x>>y; WhitePawn.x = x-'a'+1; WhitePawn.y = y; Got the point? That's why your prog passes all f*illion tests on this forum- they all have n=8. GoodLuck! | | SOS!!! В чём ошибка? | Kuras Igor | 1025. Democracy in Danger | 22 Dec 2008 00:56 | 1 | var c:array [1..101] of integer; i,k,j,kol,d:integer; begin kol:=0; read(k); for i:=1 to k do read(c[i]); for j:= k-1 downto 2 do for i:= 1 to j do if (c[i]>c[i+1]) then begin d:=c[i]; c[i]:=c[i+1]; c[i+1]:=d; end; k:=round(k/2); for i:=1 to k do kol:=kol+round(c[i]/2); write(kol); end. |
|
|