제출 #39401

#제출 시각아이디문제언어결과실행 시간메모리
39401ykmyou보물 찾기 (CEOI13_treasure2)C++14
0 / 100
0 ms1312 KiB
#include "treasure.h" int cand[8] = {1, 2, 4, 8, 16, 32, 64, 128 }; int chk[129][129], nrow[129], ncol[129]; int isTresure[129][129]; int size; void dnc(int r, int c, int nr, int nc) { if (nr < 1 || nc < 1) return; int num = 0; if (nrow[r] > 0 || ncol[c] > 0) num = countTreasure(r, c, r + nr - 1, c + nc - 1); if (num == nr * nc) { for (int i = r; i < r + nr; i++) { for (int j = c; j < c + nc; j++) { isTresure[i][j] = 1; chk[i][j] = 1; } } return; } if (nr < nc) { dnc(r, c, nr, nc / 2); dnc(r, c + nc / 2, nr, nc / 2); } else { dnc(r, c, nr / 2, nc); dnc(r + nr / 2, c, nr / 2, nc); } } int getSize(int n){ for (int i = 0; i < 7; i++) { if (cand[i] < n && n <= cand[i + 1]) { return cand[i + 1]; } } return n; } void init(int n) { size = getSize(n); for (int i = 1; i <= size; i++) { ncol[i] = nrow[i] = 0; if (n < i) continue; ncol[i] = countTreasure(i, 1, i, n); nrow[i] = countTreasure(1, i, n, i);; } } void findTreasure (int N) { init(N); for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (nrow[i] == 0 && ncol[j] == 0) continue; if (chk[i][j]) continue; chk[i][j] = 1; int rs = getSize(N - i + 1); int cs = getSize(N - j + 1); int s = rs < cs ? rs : cs; dnc(i, j, s, s); } } for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (isTresure[i][j]) Report(i, j); } } }

컴파일 시 표준 에러 (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)");
                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...