Submission #430922

#TimeUsernameProblemLanguageResultExecution timeMemory
430922tengiz05Aliens (IOI07_aliens)C++17
30 / 100
2 ms200 KiB
#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, 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...