标签:排序 content efi math 查找 mbr pac scanf tom
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)
Total Submission(s): 4095 Accepted Submission(s): 1390
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <vector> #include <queue> #include <cstdlib> #include <iomanip> #include <cmath> #include <ctime> #include <map> #include <set> using namespace std; #define lowbit(x) (x&(-x)) #define max(x,y) (x>y?x:y) #define min(x,y) (x<y?x:y) #define MAX 100000000000000000 #define MOD 1000000007 #define pi acos(-1.0) #define ei exp(1) #define PI 3.141592653589793238462 #define ios() ios::sync_with_stdio(false) #define INF 1044266558 #define mem(a) (memset(a,0,sizeof(a))) typedef long long ll; int n,R; struct Node { int x; int y; }node[1005],pos[1005]; bool cmp(Node a,Node b) { return a.x<b.x; } int main() { while(scanf("%d%d",&n,&R)!=EOF) { int ans=0,cnt=0,inf=0,start,end,tot=0; for(int i=0;i<n;i++) { scanf("%d%d",&node[i].x,&node[i].y); } sort(node,node+n,cmp); for(int i=0;i<n;i++) { tot=0; start=node[i].x,end=node[i].x+R; for(int j=i;j<n;j++) { if(node[j].x>=start && node[j].x<=end) { pos[tot].x=node[j].y; pos[tot++].y=1; pos[tot].x=node[j].y+R+1; pos[tot++].y=-1; } } sort(pos,pos+tot,cmp); for(int j=0;j<tot;j++) { cnt+=pos[j].y; inf=max(inf,cnt); } ans=max(inf,ans); } printf("%d\n",ans); } return 0; }
标签:排序 content efi math 查找 mbr pac scanf tom
原文地址:http://www.cnblogs.com/shinianhuanniyijuhaojiubujian/p/7300491.html