Pagini recente » Cod sursa (job #2173646) | Cod sursa (job #293813) | Cod sursa (job #474005) | Cod sursa (job #828108) | Cod sursa (job #1178536)
program hashuri;
type lista=^celula;
celula=record
info:longint;
pred:lista;
end;
var a:array[0..66013] of lista;
n,op,i,x:longint;
r:lista;
u:boolean;
begin
assign(input,'hashuri.in');
assign(output,'hashuri.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do begin
readln(op,x);
if op=1 then
begin
u:=false;
r:=a[x mod 666013];
while r<>nil do begin
if r^.info=x then begin u:=true; break; end;
r:=r^.pred;
end;
if not u then
begin
new(r);
r^.info:=x;
r^.pred:=a[x mod 666013];
a[x mod 666013]:=r;
end;
end;
if op=2 then
begin
r:=a[x mod 666013];
if r<>nil then begin
if r^.info=x then begin a[x mod 666013]:=a[x mod 666013]^.pred;
continue;
end;
while r^.pred^.info<>x do r:=r^.pred;
r:=r^.pred^.pred;
end;
end;
if op=3 then
begin
u:=false;
r:=a[x mod 666013];
while r<>nil do begin
if r^.info=x then begin u:=true; break end;
r:=r^.pred;
end;
if u then writeln(1)else writeln(0);
end;
end;
close(output);
end.