Submission #39394

#TimeUsernameProblemLanguageResultExecution timeMemory
39394pce913Treasure (different grader from official contest) (CEOI13_treasure2)C++14
6 / 100
0 ms2724 KiB
#include "treasure.h" #include<algorithm> #include<iostream> using namespace std; int M[405][405]; int n; const int BOUND = 128; void find_ans(int cx,int cy,int len){ if (cx > n || cy > n) return; if (len == 1){ M[cx][cy] = countTreasure(cx, cy, cx, cy) == 1; return; } //cout << cx << " " << cy << " " << len << endl; int sum = countTreasure(cx, cy, min(n, cx + len - 1), min(n, cy + len - 1)); if (sum != min(len,n-cx+1)*min(len,n-cy+1)){ find_ans(cx, cy, len / 2); find_ans(cx + len/2, cy, len / 2); find_ans(cx, cy + len / 2, len / 2); find_ans(cx + len / 2, cy + len / 2, len / 2); } else{ for (int i = cx; i <= min(n, cx + len - 1); i++){ for (int j = cy; j <= min(n, cy + len - 1); j++){ M[i][j] = 1; } } } } void findTreasure(int N) { n = N; if (n <= 4){ for (int i = 1; i <= N; ++i) for (int j = 1; j <= N; ++j) M[i][j] = countTreasure(i, j, i, j); for (int i = 1; i <= N; ++i) for (int j = 1; j <= N; ++j) if (M[i][j]) Report(i, j); return; } find_ans(1, 1, BOUND); for (int i = 1; i <= n; i++){ for (int j = 1; j <= n; j++){ if (M[i][j] == 1){ Report(i, j); } } } }

Compilation message (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...