Cod sursa(job #566126)

Utilizator andreifirstCioara Andrei Ioan andreifirst Data 28 martie 2011 17:50:20
Problema Heapuri Scor 0
Compilator fpc Status done
Runda Arhiva educationala Marime 0.58 kb
var v:array [0..200000] of longint;
    n, i, ii, x, y, j, min:longint;
    f, g:text;

begin
assign (f, 'heapuri.in'); reset (f);
assign (g, 'heapuri.ok'); rewrite (g);

read (f, n);
i:=0;
for ii := 1 to n do
  begin
  read (f, x);
  case x of
    1:begin
      readln (f, y);
      i:=i+1;
      v[i]:=y;
      end;
    2:begin
      readln (f, y);
      v[y]:=maxlongint;
      end;
    3:begin
      min:=maxlongint;
      for j := 1 to i do begin if v[j]<min then min:=v[j]; end;
      writeln (g, min);
      end;
    end;
  end;

close (f); close (g);
end.