답안 #1108

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1108 2013-06-25T08:34:17 Z hana5505 고기잡이 (KOI13_fish) C++
0 / 18
364 ms 892 KB
#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);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 892 KB Output isn't correct
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 892 KB Output is correct
2 Correct 0 ms 892 KB Output is correct
3 Correct 0 ms 892 KB Output is correct
4 Incorrect 5 ms 892 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 40 ms 892 KB Output isn't correct
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 892 KB Output isn't correct
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 364 ms 892 KB Output isn't correct
2 Halted 0 ms 0 KB -
3 Halted 0 ms 0 KB -
4 Halted 0 ms 0 KB -