# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
246369 | thecodingwizard | Treasure (different grader from official contest) (CEOI13_treasure2) | C++11 | 5 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"
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... |