이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
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... |