可以暴力的题,先按X排序,选出在【x,x+r】这个区间类符合条件的点,然后对这些点在按y排序,找出出包含最大点的矩阵。 www.2cto.com
下面是AC代码:
[cpp]
#include
#include
using namespace std;
struct node{
int x,y;
}cd[1010];
int y[1010];
bool cmp1(node a,node b){
if(a.x==b.x)
return a.y
}
int main(){
int n,r,i,j,k,l;
int ans,count,limx,limy;
while(cin>>n>>r){
ans=0;
for(i=0;i
sort(cd,cd+n,cmp1);
for(i=0;i
count=0; k=0;
for(j=i;j
y[k++]=cd[j].y;
else break;
}
sort(y,y+k);
for(j=0;j
count=0;
for(l=j;l
count++;
}
if(count>ans) ans=count;
}
}
cout<
}
return 0;
}
作者:w00w12l