| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 264612 | Namnamseo | 보물 찾기 (CEOI13_treasure2) | C++17 | 1 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... | ||||
