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 X;
int measure(int r, int c) {
int ret = Measure(r, c);
if(ret == X) Pinpoint(r, c);
return ret;
}
void Rescue(int R, int C, int RS, int CS, int x) {
X = x;
for(int r=1; r<=R; r++) {
int h = measure(r, CS);
if(h < X) continue;
int lo = CS, hi = C+1;
while(hi - lo > 1) {
int mid = (lo + hi) / 2;
if(measure(r, mid) > X) lo = mid;
else hi = mid;
}
lo = 0, hi = CS;
while(hi - lo > 1) {
int mid = (lo + hi) / 2;
if(measure(r, mid) > X) hi = mid;
else lo = mid;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |