why wrong answer 10 test???? Help please++++++++ program de; var a:array[0..100000] of longint; b:array[0..100000] of word; c:array[0..1000] of longint; i,j,n,x,y,z:longint; code:integer; s:string; begin readln(n); for i:=1 to n do begin readln(s); if (pos('PUSH',s)<>0) then begin inc(z); delete(s,1,5); for j:=1 to length(s) do if s[j]=' ' then break; val(copy(s,1,j-1),x,code); val(copy(s,j+1,length(s)-j),y,code); inc(z); a[z]:=y; b[z]:=c[x]; c[x]:=z; end else begin delete(s,1,4); val(s,x,code); writeln(a[c[x]]); c[x]:=b[c[x]]; end; end; end. Re: why wrong answer 10 test???? Help please++++++++ Послано ZiV 11 янв 2006 22:43 I made one change....and got TLE.... var a:array[0..100000] of longint; b:array[0..100000] of word; c:array[0..1000] of longint; i,j,n,x,y,z:longint; code:integer; s:string; begin readln(n); for i:=1 to n do begin readln(s); if (pos('PUSH',s)<>0) then begin inc(z); delete(s,1,pos('PUSH',s)+4); for j:=1 to length(s) do if s[j]=' ' then break; val(copy(s,1,j-1),x,code); val(copy(s,j+1,length(s)-j),y,code); inc(z); a[z]:=y; b[z]:=c[x]; c[x]:=z; end else begin delete(s,1,pos('POP',s)+3); val(s,x,code); writeln(a[c[x]]); c[x]:=b[c[x]]; end; end; end. |