Submission #1108

#TimeUsernameProblemLanguageResultExecution timeMemory
1108hana5505고기잡이 (KOI13_fish)C++98
0 / 18
364 ms892 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...