이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, x, y;
bool q(int i, int j){
if(min(i, j) < 1 || max(i, j) > n) return 0;
cout << "examine " << i << ' ' << j << endl;
string res; cin >> res;
return res[0] == 't';
}
signed main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n >> x >> y;
int xMax = x, xMin = x, yMax = y;
for(int i=1<<30, j; i/=2; ){
j = xMax + i;
if(q(j, y) && q((j+xMax)/2, y) && q(xMax+i/4, y)) xMax += i;
j = yMax + i;
if(q(x, j) && q(x, (j+yMax)/2) && q(x, yMax+i/4)) yMax += i;
j = xMin - i;
if(q(j, y) && q((j+xMin)/2, y) && q(xMin-i/4, y)) xMin -= i;
}
int w = 2*(xMax - xMin + 1);
int yMin = yMax - (xMax - xMin);
x = (xMin + xMax) / 2;
y = (yMin + yMax) / 2;
xMin = xMax = x;
yMin = yMax = y;
if(q(x-w, y)) xMin -= w;
if(q(x-w, y)) xMin -= w;
if(q(x+w, y)) xMax += w;
if(q(x+w, y)) xMax += w;
if(q(x, y-w)) yMin -= w;
if(q(x, y-w)) yMin -= w;
if(q(x, y+w)) yMax += w;
if(q(x, y+w)) yMax += w;
cout << "solution " << (xMin+xMax)/2 << ' ' << (yMin+yMax)/2 << endl;
}
| # | 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... |