제출 #40791

#제출 시각아이디문제언어결과실행 시간메모리
40791esspks21Treasure (different grader from official contest) (CEOI13_treasure2)C++14
10 / 100
2 ms640 KiB
#include "treasure.h"
#include <vector>
using namespace std;
struct pos { int r, c; };
vector<pos> vt;
// int countTreasure(int r1, int c1, int r2, int c2);
//bool findEdge(int r, int c, int n) {
//	int res = 0;
//	int mid = n >> 1;
//	if (r == 1 || c == 1)
//		res = countTreasure(r, c, r, c);
//	else if (r < mid && c < mid) { // 왼위
//		res = countTreasure(r, c, n, n)
//			- countTreasure(r + 1, c, n, n)
//			- countTreasure(r, c + 1, n, n)
//			+ countTreasure(r + 1, c + 1, n, n);
//	}
//	else if (r < mid && c >= mid) { // 오위
//		res = countTreasure(r, 1, n, c)
//			- countTreasure(r, 1, n, c - 1)
//			- countTreasure(r + 1, 1, n, c)
//			+ countTreasure(r + 1, 1, n, c - 1);
//	}
//	else if (r >= mid && c < mid) { // 왼아
//		res = countTreasure(1, c, r, n)
//			- countTreasure(1, c + 1, r, n)
//			- countTreasure(1, c, r - 1, n)
//			+ countTreasure(1, c + 1, r - 1, n);
//	}
//	else {
//		res = countTreasure(1, 1, r, c)
//			- countTreasure(1, 1, r - 1, c)
//			- countTreasure(1, 1, r, c - 1)
//			+ countTreasure(1, 1, r - 1, c - 1);
//	}
//	if (res == 1) return true;
//	return false;
//}
void findTreasure(int N) {
	//int cnt = countTreasure(1, 1, N, N);
	//if (cnt == 0) return;
	pos tmp;
	//for (int i = 1; i <= N; i++) {
	//	for (int j = 1; j <= N; j++) {
	//		if (findEdge(i, j, N)) {
	//			tmp.r = i; tmp.c = j;
	//			vt.push_back(tmp);
	//		}
	//	}
	//}
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= N; j++)
			if (countTreasure(i, j, i, j) == 1) {
				tmp.r = i; tmp.c = j;
				vt.push_back(tmp);
			}


	for (int i = 0; i < vt.size(); i++)
		Report(vt[i].r, vt[i].c);
	return;
}

컴파일 시 표준 에러 (stderr) 메시지

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)");
                                  ^
treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:59:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < vt.size(); i++)
                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...