Pagini recente » Cod sursa (job #1890840) | Istoria paginii runda/redsnow_3/clasament | Cod sursa (job #1587751) | Cod sursa (job #289531) | Cod sursa (job #609733)
Cod sursa(job #609733)
Program orase;
type tip=record
x,y:longint;
end;
var a:array [1..60000] of tip;
b1:array [1..1 shl 10] of char;
i,j,max,sol,n,m:longint;
fi,fo:text;
{procedure qsort(l,r:longint);
var k,i,j:longint;
y:tip;
begin
i:=l; j:=r;
k:=a[(l+r) div 2].x;
repeat
while a[i].x<k do inc(i);
while a[j].x>k do dec(j);
if i<=j then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i); dec(j);
end;
until i>=j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;}
begin
assign(fi,'orase.in');
assign(fo,'orase.out');
settextbuf(fi,b1);
reset(fi);
rewrite(fo);
readln(fi,n,m);
for i:=1 to n do readln(fi,a[i].x,a[i].y);
{ qsort(1,n);
sol:=-100000;
max:=a[1].y-a[1].x;
for i:=2 to n do begin
if a[i-1].y-a[i-1].x>max then max:=a[i-1].y-a[i-1].x;
if a[i].y+a[i].x+max>sol then sol:=a[i].y+a[i].x+max;
end; }
write(fo,sol);
close(fo);
end.