Pagini recente » Cod sursa (job #2638474) | Cod sursa (job #1391486) | Cod sursa (job #2531158) | Cod sursa (job #305507)
Cod sursa(job #305507)
var f,g:text;
i,u,lungmax,lung,n,p,a,b,c,o:longint;
camere:array[1..10000]of byte;
begin
assign(f,'hotel.in');reset(f);
assign(g,'hotel.out');rewrite(G);
readln(f,n,p);
for i:=1 to p do
begin
u:=a;
read(f,a);
if a=1 then begin
read(f,b,c);
o:=b;
while o<=b+c-1 do
begin
camere[o]:=1;
o:=o+1;
end;
end;
if a=2 then begin
read(f,b,c);
o:=b;
while o<=b+c-1 do
begin
camere[o]:=0;
o:=o+1;
end;
end;
if a=3 then begin
lung:=0;
lungmax:=0;
if u<3 then begin
for o:=1 to n do
if camere[o]=0 then lung:=lung+1
else begin if lung>lungmax then lungmax:=lung;
lung:=0;
end;
if lung>lungmax then lungmax:=lung;
end;
writeln(g,lungmax);
end;
readln(f);
end;
close(g);
end.