# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
264612 | Namnamseo | Treasure (different grader from official contest) (CEOI13_treasure2) | C++17 | 1 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 "treasure.h"
#include <cstring>
#include <utility>
#include <functional>
using namespace std;
int rot;
bool ans[110][110];
int n;
pair<int,int> translate(int x, int y) {
if (rot == 0) return {x, y};
if (rot == 1) return {n+1-y, x};
if (rot == 2) return {n+1-x, n+1-y};
return {y, n+1-x};
}
int ask(int x, int y) {
int fx, fy; tie(fx, fy) = translate(1, 1);
tie(x, y) = translate(x, y);
if (fx > x) swap(fx, x);
if (fy > y) swap(fy, y);
return countTreasure(fx, fy, x, y);
}
void put_ans(int i, int j, int v) {
tie(i, j) = translate(i, j);
ans[i][j] = v;
}
int tmp[110][110];
void findTreasure (int N) {
n = N;
int w = N/2, ww = N-w;
int h = N/2, hh = N-h;
memset(ans, 0, sizeof(ans));
for(rot=0; rot<4; ++rot) {
for(int i=w; i<=N; ++i) for(int j=h; j<=N; ++j) {
tmp[i][j] = ask(i, j);
}
for(int i=w+1; i<=N; ++i) for(int j=h+1; j<=N; ++j) {
put_ans(i, j,
tmp[i][j] - tmp[i-1][j] - tmp[i][j-1] + tmp[i-1][j-1]);
}
swap(w, h);
swap(h, ww);
swap(ww, hh);
}
for(int i=1; i<=N; ++i) for(int j=1; j<=N; ++j) if(ans[i][j]) Report(i, j);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |