Submission #40773

#TimeUsernameProblemLanguageResultExecution timeMemory
40773bysuTreasure (different grader from official contest) (CEOI13_treasure2)C++14
Compilation error
0 ms0 KiB
#include "treasure.h" int arr[10001][2]; int idx; int solve(int sr, int sc, int er, int ec, int total) { if (sr == er&&er == ec) { if (total == 0) return; else { arr[idx][0] = sr, arr[idx++][1] = sc; return; } } if (total == (er - sr + 1)*(ec - sc + 1)) { for (int i = sr; i <= er; i++) { for (int j = sc; j <= ec; j++) { arr[idx][0] = i; arr[idx++][1] = j; } } return; } int sum = 0; int mr = (sr + er) >> 1; int mc = (sc + ec) >> 1; int a = countTreasure(sr, sc, mr, mc); int b = countTreasure(sr, sc, er, mc); int c = countTreasure(sr, sc, mr, ec); int a1 = a; int a2 = c - a; int b1 = b - a; int b2 = total - b - c + a; if (a1 != 0)solve(sr, sc, mr, mc, a1); if (a2 != 0)solve(sr, mc + 1, mr, ec, a2); if (b1 != 0) solve(mr + 1, sc, er, mc, b1); if (b2 != 0) solve(mr + 1, mc + 1, er, ec, b2); } void findTreasure (int N) { int cnt = countTreasure(1, 1, N, N); solve(1, 1, N, N, cnt); for (int i = 0; i < idx; i++) { Report(arr[i][0], arr[i][1]); } }

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)");
                                  ^
treasure.cpp: In function 'int solve(int, int, int, int, int)':
treasure.cpp:8:4: error: return-statement with no value, in function returning 'int' [-fpermissive]
    return;
    ^
treasure.cpp:11:4: error: return-statement with no value, in function returning 'int' [-fpermissive]
    return;
    ^
treasure.cpp:21:3: error: return-statement with no value, in function returning 'int' [-fpermissive]
   return;
   ^
treasure.cpp:23:6: warning: unused variable 'sum' [-Wunused-variable]
  int sum = 0;
      ^