이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "grader.h"
int x;
int f(int a, int b, int c, int d, int xi, int yi){
if(a > c || b > d) return 0;
int r = (a + c) / 2;
int s = b, e = d;
if(xi == 0){
while(s <= e){
int m = (s + e) / 2;
int t = Measure(r, m);
if(t == x){ Pinpoint(r, m); return 1; }
else if(t > x) e = m - 1;
else s = m + 1;
}
}
else{
while(s <= e){
int m = (s + e) / 2;
int t = Measure(r, m);
if(t == x){ Pinpoint(r, m); return 1; }
else if(t < x) e = m - 1;
else s = m + 1;
}
}
int q = yi ^ xi;
return f(a, (q ? s : b), r - 1, (q ? d : s - 1), xi, yi) || f(r + 1, (q ? b : s), c, (q ? s - 1 : d), xi, yi);
}
void Rescue(int R, int C, int RS, int CS, int X) {
x = X;
if(f(1, 1, RS, CS, 0, 1)) return;
if(f(1, CS, RS, C, 1, 1)) return;
if(f(RS, 1, R, CS, 0, 0)) return;
f(RS, CS, R, C, 1, 0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |