이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
bool ask(int x, int y){
cout << "examine " << x << " " << y << endl;
string str; cin >> str;
if (str == "true") return true;
else return false;
}
int main() {
int n, x0, y0; cin >> n >> x0 >> y0;
int xt = x0, yt = y0, xb = x0, yb = y0;
while (xt > 1 && ask(xt-1, y0)) xt--;
while (xb < n && ask(xb+1, y0)) xb++;
while (yt > 1 && ask(x0, yt-1)) yt--;
while (yb < n && ask(x0, yb+1)) yb++;
int sz = xb - xt + 1;
while (xt - 2*sz >= 1 && ask(xt - 2*sz, yt)) xt = xt - 2*sz;
while (true){
if (xt - sz >= 1 && yt - sz >= 1 && ask(xt - sz, yt - sz)) xt = xt - sz, yt = yt - sz;
else if (xt + sz <= n && yt - sz >= 1 && ask(xt + sz, yt - sz)) xt = xt + sz, yt = yt - sz;
else break;
}
int xres = xt + 2*sz + sz / 2;
int yres = yt + 2*sz + sz / 2;
cout << "solution " << xres << " " << yres << 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... |