# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
246371 | thecodingwizard | Treasure (different grader from official contest) (CEOI13_treasure2) | C++11 | 6 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;
void findTreasure (int n) {
int ps1[n][n];
int ps2[n][n];
int ps3[n][n];
int ps4[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i>n/2-1&&j>n/2-1) ps1[i][j] = countTreasure(1, 1, i+1, j+1);
if (i<=n/2+1&&j<=n/2+1) ps2[i][j] = countTreasure(i+1, j+1, n, n);
if (i<=n/2+1&&j>n/2-1) ps3[i][j] = countTreasure(i+1,1,n,j+1);
if (i>n/2-1&&j<=n/2+1) ps4[i][j] = countTreasure(1,j+1,i+1,n);
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i>n/2&&j>n/2) {
if (ps1[i][j]-ps1[i-1][j]-ps1[i][j-1]+ps1[i-1][j-1] == 1) Report(i+1,j+1);
} else if (i<=n/2&&j<=n/2) {
if (ps2[i][j] - ps2[i+1][j] - ps2[i][j+1] + ps2[i+1][j+1] == 1) Report(i+1, j+1);
} else if (i<=n/2&&j>n/2) {
if (ps3[i][j] - ps3[i+1][j] - ps3[i][j-1] + ps3[i+1][j-1] == 1) Report(i+1,j+1);
} else if (i>n/2&&j<=n/2) {
if (ps4[i][j] - ps4[i-1][j] - ps4[i][j+1] + ps4[i-1][j+1] == 1) Report(i+1,j+1);
} else assert(false);
/*
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... |