이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n, m, x, y;
int d[] = {-4, -3, -2, -1, 1, 2, 3, 4};
bool ask(int x, int y){
if(x < 1 || x > n || y < 1 || y > n) return false;
cout << "examine " << x << " " << y << endl;
string s; cin >> s;
return (s == "true");
}
int find(int a, int b){
int tmp = 1;
while(ask(x + a*tmp, y + b*tmp)) tmp <<= 1;
int l = (tmp>>1), r = tmp;
int ret = l;
while(l <= r){
int mid = (l + r)/2;
if(ask(x + a*mid, y + b*mid)){
l = mid + 1;
ret = mid;
} else{
r = mid - 1;
}
}
return ret;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> x >> y;
int L = x - find(-1, 0), R = x + find(1, 0), T = y + find(0, 1), B = y - find(0, -1);
int mx = (L + R)/2, my = (T + B)/2;
int M = (R - L + 1);
int x = mx, y = my;
while(ask(x, y)) x -= 2*M;
int left = (x + 2*M);
x = mx, y = my;
while(ask(x, y)) x += 2*M;
int right = (x - 2*M);
x = mx, y = my;
while(ask(x, y)) y -= 2*M;
int bottom = (y - 2*M);
x = mx, y = my;
while(ask(x, y)) y += 2*M;
int top = (y + 2*M);
int ansX = (left + right)/2, ansY = (top + bottom)/2;
cout << "solution " << ansX << " " << ansY << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |