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"
#include <cmath>
bool v = false;
void f(int rmn, int cmn, int rmx, int cmx, int dr, int dc, int X)
{
if(v) return;
if((rmn - rmx) * dr > 0 || (cmn - cmx) * dc > 0) return;
int t = Measure(rmn, cmx);
if(t < X)
{
f(rmn + dr, cmn, rmx, cmx, dr, dc, X);
}
else if(t > X)
{
f(rmn, cmn, rmx, cmx - dc, dr, dc, X);
}
else
{
Pinpoint(rmn, cmx);
v = true;
}
}
void Rescue(int R, int C, int RS, int CS, int X) {
f(1, 1, RS, CS, 1, 1, X);
f(1, C, RS, CS, 1, -1, X);
f(R, 1, RS, CS, -1, 1, X);
f(R, C, RS, CS, -1, -1, X);
// Measure(1, 2);
// Pinpoint(1, 2);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |