답안 #42285

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42285 2018-02-25T09:53:03 Z rlqja2222 보물 찾기 (CEOI13_treasure2) C++14
4 / 100
2 ms 872 KB
#include "treasure.h"
int row[101];
int col[101];
int n, c;

void div_col(int i, int j, int rest, int r) {
	if (c == n) return;
	if (rest == (j - i + 1)) {
		for (int k = i; k <= j; k++)
			row[c] = r, col[c] = k, c++;
		return;
	}
	else {
		int mid = (i + j) / 2;
		int rest1 = countTreasure(r, i, r, mid);
		if (rest1) div_col(i, mid, rest1, r);
		int rest2 = countTreasure(r, mid + 1, r, j);
		if (rest2) div_col(mid + 1, j, rest2, r);
	}
}

void div_row(int i, int j, int rest, int N) {	
	if (c == n) return;
	if (i != j) {
		int mid = (i + j) / 2;
		int rest1 = countTreasure(i, 1, mid, N);
		if (rest1) div_row(i, mid, rest1, N);
		int rest2 = countTreasure(mid + 1, 1, j, N);
		if (rest2) div_row(mid + 1, j, rest2, N);
	}
	else {
		div_col(1, N, rest, i);
	}
}


void findTreasure(int N) {
	n = countTreasure(1, 1, N, N);
	if (n == 0) return;
	c = 0;
	div_row(1, N, n, N);

	while (--c >= 0) 
		Report(row[c], col[c]);

}

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 1 ms 248 KB Output isn't correct - N = 5, K = 980, score = 0
2 Incorrect 1 ms 352 KB Output isn't correct - N = 10, K = 13335, score = 0
3 Partially correct 1 ms 424 KB Output is partially correct - N = 15, K = 31649, score = 4
4 Incorrect 1 ms 556 KB Invalid Access
5 Execution timed out 2 ms 556 KB Time limit exceeded (wall clock)
6 Runtime error 2 ms 700 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 2 ms 748 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 2 ms 872 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 2 ms 872 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 2 ms 872 KB Execution killed with signal 11 (could be triggered by violating memory limits)