Pagini recente » Cod sursa (job #1859362) | Cod sursa (job #3276852) | Cod sursa (job #2575532) | Cod sursa (job #908963) | Cod sursa (job #338197)
Cod sursa(job #338197)
Program heapuri;
var f,g:text; a:array[1..10]of boolean;
b:array[1..10]of longint;
k,n:longint;
procedure calcul;
var x,z,w:longint; y:1..3;
begin
for x:=1 to n do begin
read (f,y);
case y of
1: begin
readln (f,z);
k:=k+1;
b[k]:=z;
a[z]:=true;
end;
2: begin
readln (f,z);
a[b[z]]:=false;
end;
3: begin
w:=1;
while not a[w] do w:=w+1;
writeln (g,w);
readln (f);
end;
end;
end;
end;
begin
assign (f,'heapuri.in'); reset (f);
assign (g,'heapuri.out'); rewrite (g);
readln (f,n);
k:=0;
calcul;
close (f); close (g);
end.