답안 #4532

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
4532 2013-10-21T16:27:48 Z kriii 보물 찾기 (CEOI13_treasure2) C++
68 / 100
0 ms 1228 KB
#include "treasure.h"

int R[105][105];

void go(int sx, int sy, int ex, int ey, int count)
{
	if (sx > ex || sy > ey) return;
	if (count == 0) return;
	if ((ex - sx + 1) * (ey - sy + 1) == count){
		int i,j;

		for (i=sx;i<=ex;i++) for (j=sy;j<=ey;j++) R[i][j] = 1;
		return;
	}

	int m,c;

	if (ex - sx >= ey - sy){
		m = (ex + sx) / 2;
		c = countTreasure(sx,sy,m,ey);
		go(sx,sy,m,ey,c);
		go(m+1,sy,ex,ey,count-c);
	}
	else{
		m = (ey + sy) / 2;
		c = countTreasure(sx,sy,ex,m);
		go(sx,sy,ex,m,c);
		go(sx,m+1,ex,ey,count-c);
	}
}

void findTreasure (int N)
{
	int i,j;
	for (i=1;i<=N;i++) for (j=1;j<=N;j++) R[i][j] = 0;
	go(1,1,N,N,countTreasure(1,1,N,N));
	for (i=1;i<=N;i++) for (j=1;j<=N;j++) if(R[i][j] == 1) Report(i, j);
}

Compilation message

grader.c: In function 'int main()':
grader.c:63:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         my_assert(strlen(A[i]+1) == N, "each line of the map must contain N zeroes or ones (before loop)");
                                  ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 1228 KB Output is partially correct - N = 5, K = 480, score = 8
2 Incorrect 0 ms 1228 KB Output is partially correct - N = 10, K = 6428, score = 4
3 Correct 0 ms 1228 KB Output is correct - N = 15, K = 12286, score = 10
4 Correct 0 ms 1228 KB Output is correct - N = 16, K = 16525, score = 10
5 Incorrect 0 ms 1228 KB Output is partially correct - N = 55, K = 6566863, score = 4
6 Incorrect 0 ms 1228 KB Output is partially correct - N = 66, K = 13820786, score = 4
7 Correct 0 ms 1228 KB Output is correct - N = 77, K = 5400779, score = 10
8 Correct 0 ms 1228 KB Output is correct - N = 88, K = 7256189, score = 10
9 Incorrect 0 ms 1228 KB Output is partially correct - N = 99, K = 69772754, score = 4
10 Incorrect 0 ms 1228 KB Output is partially correct - N = 100, K = 73299313, score = 4