# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
24908 | dotorya | 산악 구조대 (JOI13_mountain) | C++14 | 0 ms | 0 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.
void Rescue(int R, int C, int RS, int CS, int X) {
int i, j, k;
int ax = -1, ay = -1;
int x = RS, y = 1;
while (x >= 1 && x <= R && y >= 1 && y <= C && y <= CS) {
int t = Measure(x, y);
if (t == X) ax = x, ay = y;
if (t >= X) x--;
else y++;
}
x = RS, y = C;
while (x >= 1 && x <= R && y >= 1 && y <= C && y >= CS) {
int t = Measure(x, y);
if (t == X) ax = x, ay = y;
if (t >= X) x--;
else y--;
}
x = RS, y = 1;
while (x >= 1 && x <= R && y >= 1 && y <= C && y <= CS) {
int t = Measure(x, y);
if (t == X) ax = x, ay = y;
if (t >= X) x++;
else y++;
}
x = RS, y = C;
while (x >= 1 && x <= R && y >= 1 && y <= C && y >= CS) {
int t = Measure(x, y);
if (t == X) ax = x, ay = y;
if (t >= X) x++;
else y--;
}
Pinpoint(ax, ay);
}