|
|
back to boardWHY CRASH??? Please, help! I'm so puzzled! program dfx; type PoinType = ^DynType; DynType = record inf: array[1..3] of longint; next: Pointype; end; var point: array[1..1000] of pointype; l: array[1..1000] of byte; pr,pol: pointype; sn,p,q,i,n: longint; k: char; begin readln(n); for q:=1 to n do point[q]:=nil; for q:=1 to n do begin read(k,k,k,k); if k = 'H' then begin readln(sn,p); inc(l[sn]); if l[sn]>3 then begin l[sn]:=1; new(pol); pol^.inf[1]:=p; pol^.next:=point[sn]; point[sn]:=pol; end else point[sn]^.inf[l[sn]]:=p; end else begin readln(sn); writeln(point[sn]^.inf[l[sn]]); dec(l[sn]); if l[sn]=0 then begin l[sn]:=3; pr:=point[sn]^.next; if point[sn]<>nil then dispose(point[sn]); point[sn]:=pr; end; end; end; end. |
|
|