Pagini recente » Cod sursa (job #166657) | Cod sursa (job #1650375) | Cod sursa (job #2016907) | Cod sursa (job #1031745) | Cod sursa (job #163540)
Cod sursa(job #163540)
var a:array[-3000000..3000000] of shortint;
b:array[1..64] of longint;
n,m,i,j,x,y,c,max:longint;
begin
assign(input,'marbles.in');
reset(input);
assign(output,'marbles.out');
rewrite(output);
readln(n,m);
for i:=1 to n do
begin
readln(x,y);
if (x>=-3000000) and (x<=3000000) then a[x]:=y;
end;
for i:=1 to m do
begin
readln(c,x,y);
if c=0 then
begin
a[x+y]:=a[x];
a[x]:=0;
end;
if c=1 then
begin
for j:=x to y do
begin
if a[j]>0 then inc(b[a[j]]);
end;
max:=0;
for j:=1 to 64 do
begin
if b[j]>max then max:=b[j];
b[j]:=0;
end;
writeln(max);
end;
end;
close(output);
end.