# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
79410 | szawinis | Treasure (different grader from official contest) (CEOI13_treasure2) | C++17 | 3 ms | 828 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"
#include <bits/stdc++.h>
using namespace std;
int N, a[101][101], b[101][101], c[101][101], d[101][101];
void findTreasure (int n) {
N = n;
for(int i = 1; i <= N; i++) for(int j = 1; j <= N; j++) a[i][j] = b[i][j] = c[i][j] = d[i][j] = -1;
for(int i = N/2; i <= N; i++) for(int j = N/2; j <= N; j++) a[i][j] = countTreasure(1, 1, i, j);
for(int i = N/2; i <= N; i++) for(int j = 1; j <= N/2+1; j++) b[i][j] = countTreasure(1, j, i, N);
for(int i = 1; i <= N/2+1; i++) for(int j = N/2; j <= N; j++) c[i][j] = countTreasure(i, 1, N, j);
for(int i = 1; i <= N/2+1; i++) for(int j = 1; j <= N/2+1; j++) d[i][j] = countTreasure(i, j, N, N);
// for(int i = 1; i <= N; i++, cout << endl) for(int j = 1; j <= N; j++) cout << a[i][j] << ' ';
// cout << endl;
// for(int i = 1; i <= N; i++, cout << endl) for(int j = 1; j <= N; j++) cout << b[i][j] << ' ';
// cout<< endl;
// for(int i = 1; i <= N; i++, cout << endl) for(int j = 1; j <= N; j++) cout << c[i][j] << ' ';
// cout << endl;
// for(int i = 1; i <= N; i++, cout << endl) for(int j = 1; j <= N; j++) cout << d[i][j] << ' ';
// cout << endl;
for(int i = 1; i <= N; i++) for(int j = 1; j <= N; j++) {
if(i > N/2 & j > N/2 && a[i][j] - a[i-1][j] - a[i][j-1] + a[i-1][j-1]) Report(i, j);
if(i > N/2 && j <= N/2 && b[i][j] - b[i-1][j] - b[i][j+1] + b[i-1][j+1]) Report(i, j);
if(i <= N/2 && j > N/2 && c[i][j] - c[i+1][j] - c[i][j-1] + c[i+1][j-1]) Report(i, j);
if(i <= N/2 && j <= N/2 && d[i][j] - d[i+1][j] - d[i][j+1] + d[i+1][j+1]) Report(i, j);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |