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<bits/stdc++.h>
using namespace std;
#include "grader.h"
#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;
mt19937 rng( (uint32_t)chrono::steady_clock::now().time_since_epoch().count() );
void solve(int lX, int lY, int rX, int rY, bool up, bool right, int X) {
if (lX > rX || lY > rY) return ;
int x = up ? rX : lX,
y = right ? rY : lY;
int h = Measure(x, y);
if (h == X) Pinpoint(x, y);
else if (h < X) {
if (right) solve(lX, lY, rX, rY - 1, up, right, X);
else solve(lX, lY + 1, rX, rY, up, right, X);
}
else {
if (up) solve(lX, lY, rX - 1, rY, up, right, X);
else solve(lX + 1, lY, rX, rY, up, right, X);
}
}
void Rescue(int R, int C, int RS, int CS, int X) {
solve(1, 1, RS, CS, 1, 0, X);
solve(RS, 1, R, CS, 0, 0, X);
solve(1, CS, RS, C, 1, 1, X);
solve(RS, CS, R, C, 0, 1, X);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |