제출 #40807

#제출 시각아이디문제언어결과실행 시간메모리
40807meylady보물 찾기 (CEOI13_treasure2)C++14
10 / 100
2 ms568 KiB
#include "treasure.h" #include <stdio.h> int Map[104][104]; int count; void search(int r1, int c1, int r2, int c2, int cnt) { //printf("%d %d %d %d\n", r1, c1, r2, c2); //count++; if ((r1 == r2) && (c1 == c2)) { if (cnt > 0)Map[r1][c1] = 1; return; } if (r1==r2|| r2-r1 == c2-c1) {//정사각형 세로로 자르기 int mid = (c1 + c2) / 2; int num = countTreasure(r1, c1, r2, mid); search(r1, c1, r2, mid, num); search(r1, mid + 1, r2, c2, cnt -num); } else { //가로로 자르기 int mid = (r1 + r2) / 2; int num = countTreasure(r1, c1, mid, c2); search(r1, c1, mid, c2, num); search(mid + 1,c1, r2, c2, cnt - num); } } void findTreasure (int N) { int cnt = countTreasure(1, 1, N, N); count = 0; search(1, 1, N, N, cnt); //printf("%d\n", count); for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (Map[i][j] == 1)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...