This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
#include<algorithm>
using namespace std;
struct pp{
int x,y;
}ar[101],sorted[101];
int n,l,m,dnl[101];
bool cmp(struct pp a,struct pp b)
{
if(a.x==b.x) return a.y<b.y;
return a.x<b.x;
}
int cot(int x,int y,int r)
{
struct pp t,tt;
int h=l/2-r;
int i,j,c=0,tmp;
for(i=x;i<=x+r;i++){
t.x=i;
t.y=y+h;
tt.x=i;
tt.y=y;
c+=lower_bound(sorted+dnl[i]+1,sorted+dnl[i+1],t,cmp)-lower_bound(sorted+dnl[i]+1,sorted+dnl[i+1],tt,cmp)+1;
tmp=lower_bound(sorted+dnl[i]+1,sorted+dnl[i+1],t,cmp)-sorted-1;
if(sorted[tmp].x!=i || sorted[tmp].y<tt.y || sorted[tmp].y>t.y) c--;
}
return c;
}
int main()
{
int i,j,k,a,mx=0;
scanf("%d %d %d",&n,&l,&m);
for(i=1;i<=m;i++){
scanf("%d %d",&ar[i].x,&ar[i].y);
sorted[i]=ar[i];
}
sort(sorted+1,sorted+m+1,cmp);
for(i=1;i<=m;i++)
if(dnl[sorted[i].x]==0) dnl[sorted[i].x]=i;
for(i=1;i<=m;i++){
for(j=1;j<=m;j++){
for(k=1;k<l/2;k++){
a=cot(ar[i].x,ar[i].y,k);
if(mx<a) mx=a;
}
}
}
printf("%d",mx);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |