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 "grader.h"
int y_len, x_len, H;
int get_H(int y, int x) {
if (y <= 0 || y > y_len || x <= 0 || x > x_len) return 0;
int h = Measure(y, x);
if (h == H) Pinpoint(y, x);
return h;
}
void Find(int sy, int sx, int py, int px, int ey, int ex) {
while (sx != ex && get_H(sy, sx) < H) sx += px;
while (sx != ex) {
while (get_H(sy + py, sx) > H) sy += py;
sx += px;
}
}
void Rescue(int in_y, int in_x, int yS, int xS, int _H) {
y_len = in_y, x_len = in_x, H = _H;
Find(yS - 1, 1, -1, 1, 1, xS);
Find(yS - 1, x_len, -1, -1, 1, xS);
Find(yS + 1, 1, 1, 1, y_len, xS);
Find(yS + 1, x_len, 1, -1, y_len, xS);
for (int i = 1; i <= y_len; i++) get_H(i, xS);
for (int i = 1; i <= x_len; i++) get_H(yS, i);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |