# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42334 | zaqq1414 | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 2 ms | 676 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "treasure.h"
#define MAX 101
int cache[MAX][MAX]; // 각 꼭지점에서 해당 좌표까지 안에 있는 treasure 개수
int size;
void dp() {
if (size > 1)
cache[1][1] = countTreasure(1, 1, size, size) - countTreasure(1, 2, size, size) - countTreasure(2, 1, size, size) + countTreasure(2, 2, size, size);
else {
cache[1][1] = countTreasure(1, 1, 1, 1);
return;
}
for (int i = 2; i <= size; i++)
cache[i][1] = countTreasure(1, 1, i, 1) - cache[i][1];
for (int j = 2; j <= size; j++)
cache[1][j] = countTreasure(1, 1, 1, j) - cache[1][j];
for (int i = 2; i <= size; i++) {
for (int j = 2; j <= size; j++) {
cache[i][j] = countTreasure(1, 1, i, j) - cache[i - 1][j] - cache[i][j - 1] + cache[i][j];
}
}
}
void findTreasure (int N) {
// Initialize
size = N;
dp();
for (int i = 1; i <= size; i++)
for (int j = 1; j <= size; j++)
if (cache[i][j])
Report(i, j);
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |