# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
91672 | ics0503 | Aliens (IOI07_aliens) | C++17 | 3 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<stdio.h>
#include<string.h>
long long min(long long a, long long b) { if (a < b)return a; return b; }
bool qr(long long x, long long y) {
printf("examine %lld %lld\n", x, y);
fflush(stdout);
char X[10]; scanf("%s", X);
if (strcmp(X, "true") == 0)return 1; return 0;
}
void sol(long long x, long long y) {
printf("solution %lld %lld\n", x, y);
fflush(stdout);
}
int main() {
long long n, x0, y0; scanf("%lld%lld%lld", &n, &x0, &y0);
long long sx, sy, ex, ey, i, j, bef;
bef = x0;
for (i = 0;; i++) {
long long x = x0 + (1ll << i);
if (x > n)x = n;
if (x == n || qr(x, y0) == 0) {
long long s = bef, e = x;
while (s <= e) {
long long m = (s + e) / 2;
if (qr(m, y0))s = m + 1, ex = m;
else e = m - 1;
}
break;
}
bef = x;
}
bef = y0;
for (i = 0;; i++) {
long long y = y0 + (1ll << i);
if (y > n)y = n;
if (y == n || qr(x0, y) == 0) {
long long s = bef, e = y;
while (s <= e) {
long long m = (s + e) / 2;
if (qr(x0, m))s = m + 1, ey = m;
else e = m - 1;
}
break;
}
bef = y;
}
bef = x0;
for (i = 0;; i++) {
long long x = x0 - (1ll << i);
if (x <= 0)x = 1;
if (x == 1 || qr(x, y0) == 0) {
long long s = x, e = bef;
while (s <= e) {
long long m = (s + e) / 2;
if (qr(m, y0))e = m - 1, sx = m;
else s = m + 1;
}
break;
}
bef = x;
}
bef = y0;
for (i = 0;; i++) {
long long y = y0 - (1ll << i);
if (y <= 0)y = 1;
if (y == 1 || qr(x0, y) == 0) {
long long s = y, e = bef;
while (s <= e) {
long long m = (s + e) / 2;
if (qr(x0, m))e = m - 1, sy = m;
else s = m + 1;
}
break;
}
bef = y;
}
long long m = (ex - sx + 1);
while (sx>m&&sy>m&&qr(sx - m, sy - m))sx -= m, sy -= m, ex -= m, ey -= m;
while (sx>2*m&&qr(sx - 2 * m, sy))sx -= 2 * m, ex -= 2 * m;
while (sy>2*m&&qr(sx, sy - 2 * m))sy -= 2 * m, ey -= 2 * m;
sol((2 * sx + 5 * m - 1) / 2, (2 * sy + 5 * m - 1) / 2);
return 0;
}
컴파일 시 표준 에러 (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... |