# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
226475 | Kenzo_1114 | Aliens (IOI07_aliens) | C++17 | 5 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int N = 2e9;
int n;
long long int xo, yo;
char ASK[10];
bool ask(long long int x, long long int y)
{
printf("examine %lld %lld\n", x, y);
scanf(" %s", ASK);
if(ASK[0] == 't') return true;
else return false;
}
void bb(int dx, int dy)
{
long long int bg = 0, ed = n;
while(bg < ed)
{
long long int mid = (bg == ed - 1) ? ed : (bg + ed) >> 1;
long long int nx = xo + dx * mid, ny = yo + dy * mid;
if(1 > nx || nx > n || 1 > ny || ny > n) ed = mid - 1;
else if(ask(nx, ny)) bg = mid;
else ed = mid - 1;
}
xo += dx * bg, yo += dy * bg;
}
int main ()
{
scanf("%d %lld %lld", &n, &xo, &yo);
bb(1, 0);
bb(0, 1);
bb(1, 1);
long long int x = xo, y = yo;
bb(-1, -1);
xo = x, y = yo;
bb(-1, 1);
x = xo, y = yo;
bb(1, -1);
printf("solution %lld %lld\n", (x + xo) / 2, (y + yo) / 2);
}
Compilation message (stderr)
# | 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... |