# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
173159 | lee107601 | Treasure (different grader from official contest) (CEOI13_treasure2) | C++14 | 2 ms | 376 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"
void go(int sy,int sx,int ey,int ex,int ret,int typ) {
if (sy == sx && ex == ey) {
Report(sy, sx);
return;
}
if (typ == 0) {//x축으로 줄일것
int midx = (sx + ex) / 2;
int v = 0;
v = countTreasure(sy, sx, ey, midx);
if (v != 0) {
if (sx == midx) go(sy, sx, ey, midx, v,1);
else go(sy, sx, ey, midx, v, 0);
}
if (v == ret) return;
if ((midx+1) == ex) go(sy, midx + 1, ey, ex, ret - v, 1);
else go(sy, midx + 1, ey, ex, ret - v, 0);
}
else {//y축으로 줄일것
int midy = (sy + ey) / 2;
int v = 0;
v = countTreasure(sy, sx, midy, ex);
if (v != 0) {
go(sy, sx, midy, ex, v, 1);
}
if (v == ret) return;
go(midy+1, sx, ey, ex, ret - v, 1);
}
}
void findTreasure (int N) {
int cnt = countTreasure(1, 1, N, N);
if (cnt != 0) go(1, 1, N, N, cnt, 0);
//if(cnt > 0) Report (1, 1);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |