# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
310787 | Fischer | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 1 ms | 512 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;
const int maxn = 110;
int acc[maxn][maxn];
bool mat[maxn][maxn];
void findTreasure(int n) {
for (int i = n; i >= 1; --i) {
for (int j = n; j >= 1; --j) {
if (i <= n/2 && j <= n/2)
acc[i][j] = countTreasure(i+1, j+1, n, n) - acc[n][n] + acc[i][n] + acc[n][j];
else if (i <= n/2)
acc[i][j] = acc[n][j] - countTreasure(i+1, 1, n, j);
else if (j <= n/2)
acc[i][j] = acc[i][n] - countTreasure(1, j+1, i, n);
else
acc[i][j] = countTreasure(1, 1, i, j);
}
}
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
mat[i][j] = acc[i][j] - acc[i-1][j] - acc[i][j-1] + acc[i-1][j-1];
}
}
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
if (mat[i][j]) Report(i, j);
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |