Submission #572742

#TimeUsernameProblemLanguageResultExecution timeMemory
572742snasibov05Aliens (IOI07_aliens)C++14
20 / 100
5 ms288 KiB
#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 (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 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...