이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i64 n, x, y;
std::cin >> n >> x >> y;
auto ask = [&](i64 x, i64 y) {
if (x <= 0 || y <= 0 || x > n || y > n) {
return false;
}
std::cout << "examine " << x << " " << y << std::endl;
std::string res;
std::cin >> res;
return res == "true";
};
for (int i = 2; ; i *= 2) {
if (!ask(x, y + i)) {
for (int j = i / 2; j > 0; j /= 2) {
if (ask(x, y + j)) {
y += j;
}
}
break;
}
}
for (int i = 2; ; i *= 2) {
if (!ask(x + i, y)) {
for (int j = i / 2; j > 0; j /= 2) {
if (ask(x + j, y)) {
x += j;
}
}
break;
}
}
i64 X = x, Y = y;
for (int i = 2; ; i *= 2) {
if (!ask(X, Y - i)) {
for (int j = i / 2; j > 0; j /= 2) {
if (ask(X, Y - j)) {
Y -= j;
}
}
break;
}
}
i64 len = y - Y + 1;
// std::cout << X << " " << Y << "\n";
// std::cout << len << std::endl;
while (ask(x + len, y + len)) {
x += len;
y += len;
}
while (ask(x, y + len * 2)) {
y += len * 2;
}
while (ask(x + len * 2, y)) {
x += len * 2;
}
std::cout << "solution " << x - len * 2 - len / 2 << " " << y - len * 2 - len / 2 << std::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... |