제출 #158112

#제출 시각아이디문제언어결과실행 시간메모리
158112faremyAliens (IOI07_aliens)C++14
100 / 100
4 ms380 KiB
#include <iostream> #include <algorithm> #include <string> bool isblack(long long x, long long y, long long size) { if (x < 1 || x > size || y < 1 || y > size) return false; std::cout << "examine " << x << ' ' << y << '\n'; std::string ans; std::cin >> ans; if (ans == "true") return true; return false; } void center(long long x, long long y) { std::cout << "solution " << x << ' ' << y << '\n'; } int main() { long long size, xb, yb; std::cin >> size >> xb >> yb; long long k = 0, xr = xb; while (isblack(xr + (1 << k), yb, size)) k++; k--; for (; k > -1; k--) if (isblack(xr + (1 << k), yb, size)) xr += (1 << k); k = 0; long long xl = xb; while (isblack(xl - (1 << k), yb, size)) k++; k--; for (; k > -1; k--) if (isblack(xl - (1 << k), yb, size)) xl -= (1 << k); k = 0; long long y = yb; while (isblack(xb, y + (1 << k), size)) k++; k--; for (; k > -1; k--) if (isblack(xb, y + (1 << k), size)) y += (1 << k); long long chksize = (xr - xl + 1); long long xc = (xl + xr) / 2; long long yc = y - chksize / 2; int l = isblack(xc - 2 * chksize, yc, size) + isblack(xc - 4 * chksize, yc, size); int r = isblack(xc + 2 * chksize, yc, size) + isblack(xc + 4 * chksize, yc, size); long long ax = xc; if ((l + r) % 2 == 1) { ax += chksize; l += 1; } ax += (r - l) * chksize; l = isblack(xc, yc - 2 * chksize, size) + isblack(xc, yc - 4 * chksize, size); r = isblack(xc, yc + 2 * chksize, size) + isblack(xc, yc + 4 * chksize, size); long long ay = yc; if ((l + r) % 2 == 1) { ay += chksize; l += 1; } ay += (r - l) * chksize; center(ax, ay); 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...