# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
63163 | khsoo01 | Treasure (different grader from official contest) (CEOI13_treasure2) | C++11 | 4 ms | 900 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |