| Show all threads Hide all threads Show all messages Hide all messages |
| Why wrong answer5?????? See my code. | Programmer | 1067. Disk Tree | 23 Jul 2010 16:55 | 3 |
type pver=^tver; pe=^te; te=record e:pe; ver:pver; end; tver=record s:string; e:pe; end; type trec=record s:string; ver:pver; end; var i,n:word; s:string; pb,ver:pver; fir:boolean; procedure add(s:string;ver:pver); var e:pe; vt:pver; begin if s='' then exit; e:=ver^.e; while e<>nil do begin if copy(s,1,pos('\',s)-1)=e^.ver^.s then begin delete(s,1,pos('\',s)); add(s,e^.ver); exit; end; e:=e^.e; end; new(vt); vt^.e:=nil; if pos('\',s)>0 then vt^.s:=copy(s,1,pos('\',s)-1) else vt^.s:=s; new(e); e^.ver:=vt; e^.e:=ver^.e; ver^.e:=e; if pos('\',s)>0 then begin delete(s,1,pos('\',s)); add(s,vt); end; end; procedure writ(ver:pver;ur:word); var a:array [1..600] of trec; t:trec; kol,u,i:word; e:pe; begin kol:=0; e:=ver^.e; while e<>nil do begin inc(kol); a[kol].s:=e^.ver^.s; a[kol].ver:=e^.ver; e:=e^.e; end; if kol=0 then exit; for u:=1 to kol-1 do for i:=1 to kol-u do if a[i].s>a[i+1].s then begin t:=a[i]; a[i]:=a[i+1]; a[i+1]:=t; end; for i:=1 to kol do begin { if not fir then writeln; fir:=false;} for u:=1 to ur do write(' '); writeln(a[i].s); writ(a[i].ver,ur+1); end; end; begin new(pb); pb^.e:=nil; readln(n); for i:=1 to n do begin readln(s); add(s,pb); end; fir:=true; writ(pb,0); end. This test help me. 2 GAMES\GGG GAMES |
| MLE #13 or TLE #13 | Alexander Samal | 1269. Obscene Words Filter | 23 Jul 2010 03:53 | 3 |
Aho-Corasic I think will make AC :) Accepted:) Edited by author 23.07.2010 21:41 |
| Wrong answer 6 | DnS [Samara SAU] | 1070. Local Time | 23 Jul 2010 02:17 | 1 |
Double post. Wrong! please delete this post. Edited by author 23.07.2010 02:19 Edited by author 23.07.2010 02:19 |
| Hmf. Error in test #10 | Egor Suvorov | 1116. Piecewise Constant Function | 23 Jul 2010 00:57 | 3 |
Try this: 2 1 2 2 2 3 3 0 Right answer: 2 1 2 2 2 3 3 I had WA, and now I have AC! Edited by author 01.10.2007 20:17 Edited by author 01.10.2007 20:17 my program passed this test but WA #10! |
| to admins | Oleg Vasilenko (Chelyabinsk) | 1524. Men in Black | 22 Jul 2010 20:33 | 1 |
to admins Oleg Vasilenko (Chelyabinsk) 22 Jul 2010 20:33 Please, help me with test 2. Can you say me, how much my answer differs from correct answer? |
| Is 1,2,4,6,5,3 also right?????????? | Зане(Нан) | 1040. Airline Company | 22 Jul 2010 09:52 | 3 |
Who can tell me? I have WA1. Thanks a lot. Edited by author 03.05.2009 09:55 Edited by author 03.05.2009 09:56 Edited by moderator 13.05.2009 01:51 "If there are several flights that depart from one airport then the greatest common divisor of their flight numbers should be equal to 1." input 6 6 1 2 2 3 2 4 4 3 5 6 4 5 output 1 2 4 6 5 3 This output isn't correct because for second flight (2, 3) gcd is equal to 2 != 1. Edited by moderator 13.05.2009 01:52 O_o "If there are several FLIGHTS that depart from one AIRPORT then the greatest common divisor of their flight numbers should be equal to 1." Why did you calculate gcd for the second flight? Output is a numbers of flights, not numbers of flights. May be you should do this for the second airport. However gcd of the flight numbers of the second airport is gcd(1,2,4) = 1. P.S. I think output is not right because gcd of the flight numbers from the airport #3 is equal to 2. Edited by author 22.07.2010 10:00 |
| What's the point of this problem...(+) | 2rf | 1510. Order | 22 Jul 2010 05:35 | 1 |
|
| No subject | Radi Muhammad Reza | 1484. Film Rating | 22 Jul 2010 00:44 | 1 |
Edited by author 25.04.2012 19:42 |
| Method | SerailHydra | 1272. Non-Yekaterinburg Subway | 22 Jul 2010 00:00 | 3 |
Method SerailHydra 10 Nov 2007 17:57 You can consider that the cost of the tunnel is 1, and the bridge is 24000. Then it becomes a MST problem. would be better to make weight tunnel 0, the weight of the bridge 1, and the answer is weight of minimal spanning tree Your idea is interesting, but weird a bit. :) It can be solved with DFS easily. Moreover, you even don't need to know anything about bridges. |
| hint for test 5 | kyo_key | 1269. Obscene Words Filter | 21 Jul 2010 22:48 | 4 |
use while (getchar()!='\n'); don't use scanf("\n"); scanf("\n") not just wait for \n ,it will skip all blank char Edited by author 11.05.2009 10:57 useful hint!&&now i TLE 13.. I passed this test using getline(cin, str, '\n'); Now I have MLE #13 :( |
| After Queen 2 it's easy =) | quick(YaroslavlSU) | 1453. Queen | 21 Jul 2010 19:09 | 1 |
|
| Sort and Output element n/2 | ░▒ Nguyễn Kim Vỹ - Нгуен Ким Ви - Nguyen kim Vy ▒░ | 1510. Order | 21 Jul 2010 16:10 | 2 |
this algo with O(n*log(n)) but i don't know why WA on Test21, please help me! [code deleted] Edited by moderator 24.11.2019 13:39 Your mistakes: a[100001] must be a[500001] a[(n-1)/2] must be a[(n+1)/2] qsort(a,n,sizeof(int),compare) must be qsort(a,n+1,sizeof(int),compare). So AC is here: [code deleted] Edited by moderator 24.11.2019 13:38 |
| Suffix trees/arrays | Andrew Shmig [VlSU] | | 21 Jul 2010 03:32 | 4 |
Which problems on Timus I can solve using suffix trees/arrays? Thx. May be 1393 is suffix array problem, but i'm not sure. Also 1297 has simple KMP solution O(N^2), but I red in discussion of that problem about suffix tree O(N)solution. Also 1354 has simple O(N) solution via KMP but you can apply suffix tree here as I a red in discussion. Edited by author 18.07.2010 10:22 Thx! I will try to solve these problems! May be 1393 is suffix array problem, but i'm not sure. Also 1297 has simple KMP solution O(N^2), but I red in discussion of that problem about suffix tree O(N)solution. Also 1354 has simple O(N) solution via KMP but you can apply suffix tree here as I a red in discussion. Edited by author 18.07.2010 10:22 |
| I think i am correct ! But why wa14? pls help.(fw: code) | Radi Muhammad Reza | 1287. Mars Canals | 20 Jul 2010 17:45 | 1 |
[code deleted] sorry.stupid mistake.AC Edited by author 20.07.2010 18:09 |
| Question | Andrew Shmig [VlSU] | 1414. Astronomical Database | 19 Jul 2010 22:38 | 3 |
Question Andrew Shmig [VlSU] 19 Jul 2010 20:10 Is it possible to solve this problem using suffix tree? or it will get MLE? Re: Question Лукьянчиков Владимир Игоревич 19 Jul 2010 21:18 I solved it with std::set. Just use lower_bound() and upper_bound() functions. Applying lower_bound() is quite straightforwardly(yourSetObject.lower_bound(string)), but upper_bound() requires additinal {max_word_len-string.len} 'z' symbols. Read documentation and you will understand why. That's all! I am using C# and dont really know if there is something like lower_bound(), thats why I am asking about suffix tree/array :) |
| If two squares don't intersect | Mato_No1 | 1006. Square Frames | 19 Jul 2010 17:23 | 2 |
For example, xxx┌────┐xxxxx xxx│xxxxxx│x┌──┐ xxx│xxxxxx│x│xxx│ xxx│xxxxxx│x│xxx│ xxx│xxxxxx│x└──┘ xxx└────┘xxxxx Should I output the left first, or the right first? Edited by author 19.07.2010 15:39 |
| Why I got WA?Help me! | Z H Pascal | 1324. Extra Spaces | 19 Jul 2010 01:42 | 2 |
Here is my program:program Space; var L, R, I, J, K : longint; s : array [1.. 1000] of longint; begin readln (L); if L < 2 then R := 0; for I := 1 to 1000 do s [I] := 0; if L > 1 then begin I := 2; J := 2; s [1] := 2; R := 1; repeat if L > J then begin inc (R); s [R] := I; if R > 3 then inc (s [R]); I := J + 1; J := (I + 2 - s [R]) * s [R] - 2; end; until L <= J; end; writeln (R); for I := R downto 1 do writeln (s [I]); end. As for me - I don't try to create solution by "jumps". I go from 2 to N and some times add i/2+1 to answer. |
| Oh! There are more than one tests. | Mato_No1 | 1004. Sightseeing Trip | 18 Jul 2010 20:51 | 1 |
|
| [WA #2] why my code got WA #2 | Luke Fang | 1078. Segments | 18 Jul 2010 18:42 | 1 |
This is my code. I don't know why got the WA #2. But When I use the sample in the forum, I got the same answer as result in the forum. Could someone tell my which place take wrong? I really appreciate you. #include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct{ int right; int left; int index; int win; int lose; }segment; int contain(segment a,segment b){ if (a.left > b.left && a.right < b.right ) return 1; else return 0; }
int main(){ int i,j,m,num; segment point[500],tmp; memset(point , '\0' , sizeof(point) ); scanf("%d",&num); if(num < 0 || num > 500) exit(0); for(i = 0 ; i < num ; i++){ scanf("%d %d",&point[i].left , &point[i].right ); if(point[i].left > 10000 || point[i].left < -10000) exit(0); else if(point[i].right > 10000 || point[i].right < -10000) exit(0); point[i].index = i; } for(i = 0 ; i < num ; i++){ if(point[i].left > point[i].right){ m = point[i].left; point[i].left = point[i].right; point[i].right = m ; } } /* for(i = 0 ; i < num ; i ++){ printf("%2d %2d\n",point[i].left , point[i].right); } */ for (i = 0 ; i < num ; i++){ for(j = 0; j < num; j++){ if( ( i != j ) && ( contain( point[i] , point[j] ) ) ){ /* printf("i = %d j = %d \n" , i, j); */ point[i].lose ++; point[j].win ++; } } } /* for(i = 0 ; i < num ; i ++){ printf("%2d %2d\n",point[i].win , point[i].lose); } */ for(i = 0 ; i < num ; i ++){ for(j = i ; j < num ; j++ ){ if ( point[i].lose < point[j].lose ){
tmp = point[i]; point[i] = point[j]; point[j] = tmp ; } } } for(i = point[0].lose ; i < num ; i ++){ for(j = i ; j < num ; j++ ){ if ( point[i].win < point[j].win ){ tmp = point[i]; point[i] = point[j]; point[j] = tmp ; } } }
printf("%d\n",point[0].lose + 1);
for(i = 0 ; i <= point[0].lose ; i ++){ printf("%d ",point[i].index+1); } return 0; } |
| WA on test 3 ! | Alexandru Popa | 1341. Device | 18 Jul 2010 12:47 | 3 |
Can anybody help me with this test, please ? 56 179 1111 Understand What Wrong? Coordinat's must be at [-180..180] Edited by author 18.07.2010 12:52 |