www.pudn.com > TJU.rar > ac1064.pas
program tju1064;
const
maxn=100;
var
x,y:array[1..maxn]of longint;
n,r,i,j,k,c,ans:word;
begin
repeat
read(n,r);
for i:=1 to n do
read(x[i],y[i]);
ans:=0;
for i:=1 to n do
for j:=1 to n do
if (x[i]<=x[j]) and (x[j]-x[i]<=r) and (y[i]>=y[j]) and (y[i]-y[j]<=r) then begin
c:=0;
for k:=1 to n do
if (x[k]>=x[i]) and (x[k]-x[i]<=r) and (y[k]>=y[j]) and (y[k]-y[j]<=r) then inc(c);
if c>ans then ans:=c;
end;
writeln(ans);
until seekeof;
end.