Pagini recente » Cod sursa (job #2507663) | Cod sursa (job #27421) | Cod sursa (job #3276644) | Cod sursa (job #2782102) | Cod sursa (job #305510)
Cod sursa(job #305510)
var f,g:text;
i,u,lungmax,lung,n,p,a,b,c,o:longint;
camere:array[1..100000]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);
case a of
1: begin
read(f,b,c);
o:=b;
while o<=b+c-1 do
begin
camere[o]:=1;
o:=o+1;
end;
end;
2:begin
read(f,b,c);
o:=b;
while o<=b+c-1 do
begin
camere[o]:=0;
o:=o+1;
end;
end;
3: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;
end;
readln(f);
end;
close(g);
end.