Submission #40782

#TimeUsernameProblemLanguageResultExecution timeMemory
40782969Treasure (different grader from official contest) (CEOI13_treasure2)C++14
0 / 100
2 ms796 KiB
#include "treasure.h" #include <iostream> #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); } }

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...