Submission #94873

#TimeUsernameProblemLanguageResultExecution timeMemory
94873rhdmstjrTreasure (different grader from official contest) (CEOI13_treasure2)C++11
Compilation error
0 ms0 KiB
#include "treasure.h" #include <vector> using namespace std; #define MAX_N 104 int pSum[MAX_N][MAX_N]; // [1, 100] bool isTreasure(int r, int c) { return pSum[r][c] - pSum[r-1][c] - pSum[r][c-1] + pSum[r-1][c-1]; } int memo[MAX_N][MAX_N] = {-1, }; int countTreasure(int r1, int c1, int r2, int c2) { int &m = memo[] } int n; void initPSum() { // init pSum // 일단은 한 방향 + 최적화 없이 pSum[n][n] = countTreasure(1, 1, n, n); int half_boundary = (n + 1) / 2; for(int i = 1; i < n; i++) { if (half_boundary <= i ){ pSum[i][n] = countTreasure(1, 1, i, n); pSum[n][i] = countTreasure(1, 1, n, i); } else { pSum[i][n] = pSum[n][n] - countTreasure(i + 1, 1, n, n); pSum[n][i] = pSum[n][n] - countTreasure(1, i + 1, n, n); } } if ((n & 1) == 0) half_boundary++; for(int r = 1; r < n; r++) { for(int c = 1; c < n; c++) { if (r < half_boundary) { if (c < half_boundary) { pSum[r][c] = countTreasure(r + 1, c + 1, n, n) + pSum[r][n] + pSum[n][c] - pSum[n][n]; } else { pSum[r][c] = pSum[n][c] - countTreasure(r + 1, 1, n, c); } } else { if (c < half_boundary) { pSum[r][c] = pSum[r][n] - countTreasure(1, c + 1, r, n); } else{ pSum[r][c] = countTreasure(1, 1, r, c); } } } } } void findTreasure (int N) { n = N; initPSum(); for(int r = 1; r <= N; r++) { for(int c = 1; c <= N; c++) { if (isTreasure(r, c)) { Report(r, c); } } } }

Compilation message (stderr)

treasure.cpp: In function 'int countTreasure(int, int, int, int)':
treasure.cpp:16:19: error: expected primary-expression before ']' token
     int &m = memo[]
                   ^
treasure.cpp:16:10: warning: unused variable 'm' [-Wunused-variable]
     int &m = memo[]
          ^
treasure.cpp:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^