Submission #63163

#TimeUsernameProblemLanguageResultExecution timeMemory
63163khsoo01Treasure (different grader from official contest) (CEOI13_treasure2)C++11
100 / 100
4 ms900 KiB
#include "treasure.h" int n, a[105][105], c[4][105][105]; int px[105], sx[105], py[105], sy[105], aa; int getc (int K, int A, int B) { if(~c[K][A][B]) return c[K][A][B]; int R; if(K == 0) R = countTreasure(1, 1, A, B); if(K == 1) R = countTreasure(1, B, A, n); if(K == 2) R = countTreasure(A, 1, n, B); if(K == 3) R = countTreasure(A, B, n, n); c[K][A][B] = R; return R; } void findTreasure (int N) { n = N; for(int k=0;k<4;k++) { for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { c[k][i][j] = -1; } } } aa = getc(0, n, n); for(int i=1;i<=n;i++) { if(i <= n/2) { px[i] = aa - getc(2, i+1, n); py[i] = aa - getc(1, n, i+1); } else { px[i] = getc(0, i, n); py[i] = getc(0, n, i); } } for(int i=1;i<=n;i++) { sx[i] = aa - px[i-1]; sy[i] = aa - py[i-1]; } for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { if(i > n/2 && j > n/2) { a[i][j] = getc(0, i, j); } else if(i > n/2) { a[i][j] = getc(1, i, j+1); a[i][j] = px[i] - a[i][j]; } else if(j > n/2) { a[i][j] = getc(2, i+1, j); a[i][j] = py[j] - a[i][j]; } else { a[i][j] = getc(3, i+1, j+1); a[i][j] = px[i] - (sy[j+1] - a[i][j]); } } } for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { if(a[i][j] - a[i-1][j] - a[i][j-1] + a[i-1][j-1]) { Report(i, j); } } } }

Compilation message (stderr)

treasure.cpp: In function 'int getc(int, int, int)':
treasure.cpp:14:13: warning: 'R' may be used uninitialized in this function [-Wmaybe-uninitialized]
  c[K][A][B] = R;
  ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...