Submission #130720

#TimeUsernameProblemLanguageResultExecution timeMemory
130720yeonwanTreasure (different grader from official contest) (CEOI13_treasure2)C++14
Compilation error
0 ms0 KiB
#include "treasure.h" int ans[103][103]; void recursively_find(int a, int b, int c, int d) { //(a,b) ~ (c,d) 까지. int cnt = countTreasure(a, b, c, d); if (cnt == 0) return; if (c - a) + (d - b) == 1 && cnt == 1) { if (countTreasure(a, b, a, b)) ans[a][b] = 1; else ans[c][d] = 1; return; } if (cnt == (c - a + 1) * (d - b + 1)) { for (int i = a; i <= c; i++) { for (int j = b; j <= d; j++) ans[i][j] = 1; } return; } if (a == c && b == d) return; int depth = c - a ; int width = d - b ; if (depth >= width) { // 세로 >= 가로 recursively_find(a, b, a + depth/2, d); recursively_find(a + depth/2+1, b , c, d); } else { // 가로 > 세로 recursively_find(a, b, c, b+ width/2 ); recursively_find(a, b + width/2 + 1 , c, d); } } void findTreasure(int N) { recursively_find(1, 1, N, N); for (int i = 1; i <= N; i++) { for (int j = 1; j <= N; j++) { if (ans[i][j]) Report(i, j); } } }

Compilation message (stderr)

treasure.cpp: In function 'void recursively_find(int, int, int, int)':
treasure.cpp:10:39: error: expected ';' before ')' token
  if (c - a) + (d - b) == 1 && cnt == 1) {
                                       ^
treasure.cpp:10:28: warning: statement has no effect [-Wunused-value]
  if (c - a) + (d - b) == 1 && cnt == 1) {
             ~~~~~~~~~~~~~~~^~~~~~~~~~~