# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
246369 | thecodingwizard | 보물 찾기 (CEOI13_treasure2) | C++11 | 5 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "treasure.h"
void findTreasure (int n) {
int ps[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i>n/2&&j>n/2) ps[i][j] = countTreasure(1, 1, i+1, j+1);
else if (i<=n/2&&j<=n/2) ps[i][j] = countTreasure(i+1, j+1, n, n);
else if (i<=n/2&&j>n/2) ps[i][j] = countTreasure(i+1,1,n,j+1);
else if (i>n/2&&j<=n/2) ps[i][j] = countTreasure(1,j+1,i+1,n);
else assert(false);
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i>n/2&&j>n/2) {
if (ps[i][j]-(i-1>n/2?ps[i-1][j]:0)-(j-1>n/2?ps[i][j-1]:0)+(i-1>n/2&&j-1>n/2?ps[i-1][j-1]:0) == 1) Report(i+1,j+1);
} else if (i<=n/2&&j<=n/2) {
if (ps[i][j] - (i+1<=n/2?ps[i+1][j]:0) - (j+1<=n/2?ps[i][j+1]:0) + (i+1<=n/2&&j+1<=n/2?ps[i+1][j+1]:0) == 1) Report(i+1, j+1);
} else if (i<=n/2&&j>n/2) {
if (ps[i][j] - (i+1<=n/2?ps[i+1][j]:0) - (j-1>n/2?ps[i][j-1]:0) + (i+1<=n/2&&j-1>n/2?ps[i+1][j-1]:0) == 1) Report(i+1,j+1);
} else if (i>n/2&&j<=n/2) {
if (ps[i][j] - (i-1>n/2?ps[i-1][j]:0) - (j+1<=n/2?ps[i][j+1]:0) + (i-1>n/2&&j+1<=n/2?ps[i-1][j+1]:0) == 1) Report(i+1,j+1);
} else assert(false);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |