제출 #40783

#제출 시각아이디문제언어결과실행 시간메모리
40783969보물 찾기 (CEOI13_treasure2)C++14
컴파일 에러
0 ms0 KiB
#include "treasure.h" #define MAX 1000000 #define NMAX 101 int count[MAX]; class TREASURE { public: int x, y; }; int tresureCnt; TREASURE treasure[NMAX * NMAX]; void recursive(int y, int x, int N, int k) { if (N == 1) { treasure[tresureCnt++] = { x, y }; return; } printf("y : %d x : %d\n", y, x); count[k * 4 + 1] = countTreasure(y, x, y + (N + 1) / 2 - 1, x + (N + 1) / 2 - 1); if(count[k * 4 + 1] != count[k]) count[k * 4 + 2] = countTreasure(y, x, y + (N + 1) / 2 - 1, x + N - 1) - count[4 * k + 1]; if(count[k * 4 + 1] + count[4 * k + 2] != count[k]) count[k * 4 + 3] = countTreasure(y, x, y + N - 1, x + (N + 1) / 2 - 1) - count[4 * k + 1]; count[k * 4 + 4] = count[k] - count[k * 4 + 1] - count[k * 4 + 2] - count[k * 4 + 3]; if (count[k * 4 + 1] != 0) { recursive(y, x, (N + 1) / 2, 4 * k + 1); } if (count[k * 4 + 2] != 0) { recursive(y, x + (N + 1) / 2, (N + 1) / 2, k * 4 + 2); } if (count[k * 4 + 3] != 0) { recursive(y + (N + 1) / 2, x, (N + 1) / 2, k * 4 + 3); } if (count[k * 4 + 4] != 0) { recursive(y + (N + 1) / 2, x + (N + 1) / 2, (N + 1) / 2, k * 4 + 4); } } void findTreasure (int N) { // 전체 보물의 수 int cnt = countTreasure(1, 1, N, N); count[0] = cnt; if(count[0] > 0) recursive(1, 1, N, 0); if (cnt > 0) { for (int i = 0; i < tresureCnt; i++) Report(treasure[i].y, treasure[i].x); } }

컴파일 시 표준 에러 (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 recursive(int, int, int, int)':
treasure.cpp:18:32: error: 'printf' was not declared in this scope
  printf("y : %d x : %d\n", y, x);
                                ^