# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
246376 | thecodingwizard | Treasure (different grader from official contest) (CEOI13_treasure2) | C++11 | 5 ms | 384 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 <bits/stdc++.h>
#include "treasure.h"
using namespace std;
void findTreasure (int n) {
int ps[n+1][n+1];
int m = (n+1)/2;
for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) ps[i][j] = 0;
for (int i = n; i >= 1; i--) {
for (int j = n; j >= 1; j--) {
if (i>=m&&j>=m) {
ps[i][j] = countTreasure(1, 1, i, j);
} else if (i >= m) {
ps[i][j] = ps[i][n] - countTreasure(1, j+1, i, n);
} else if (j >= m) {
ps[i][j] = ps[n][j] - countTreasure(i+1, 1, n, j);
} else {
ps[i][j] = ps[i][n] + ps[n][j] + countTreasure(i+1, j+1, n, n) - ps[n][n];
}
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (ps[i][j] - ps[i-1][j] - ps[i][j-1] + ps[i-1][j-1] == 1) Report(i, j);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |