/*Dalian Warm-up B do not bow, do not give up, do not be discouraged, do not panic test instructions: Coordinate plane to a lot of points, put a side length of r and axis parallel to the square, asked the number of points in the square inside. Idea: Sort by x, then make sure X is in the legal range followed by Y to scan the line. */#include<bits/stdc++.h>using namespacestd;BOOLvis[1050];structst{voidRead () {scanf ("%d%d",&x,&y); } intx, y;}; St jilu[1050];BOOLCMP (St A,st b) {returna.x<b.x;}BOOLCMP2 (St A,st b) {returna.y<b.y;}intMain () {intN,r; while(SCANF ("%d%d", &n,&r)! =EOF) { intans=1; memset (Vis,0,sizeof(VIS)); for(intI=0; i<n;i++) Jilu[i].read (); Sort (Jilu,jilu+n,cmp); intEd=0; for(intI=0; i<n;i++){ while(ed<n&&jilu[ed].x<=jilu[i].x+r) ed++; Sort (Jilu+i,jilu+ED,CMP2); intnum=1; intst=i; for(intj=i+1; j<ed;j++){ while(jilu[st].y<jilu[j].y-r) st++; Ans=max (ans,j-st+1); } sort (Jilu+i,jilu+ed,cmp); } printf ("%d\n", ans); }}
HUD 4007 [Scan line] [order]