# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
68391 | 2018-08-17T04:17:10 Z | nvmdava | Aliens (IOI07_aliens) | C++17 | 5 ms | 556 KB |
#include <bits/stdc++.h> using namespace std; long long n; char s[10]; bool ask(int x, int y){ if(x > n || x < 1 || y > n || y < 1){ return 0; } printf("examine %d %d\n", x, y); fflush(stdout); scanf("%s", &s); return (s[0] == 't'); } long long x, y, m; int main(){ scanf("%d %d %d",&n,&x,&y); long long left, right, up, down; long long l = 0, r = x; while(l + 1 != r){ int m = (l + r) / 2; if(ask(m, y)){ r = m; } else { l = m; } } left = l; l = x, r = n + 1; while(l + 1 != r){ int m = (l + r) / 2; if(ask(m, y)){ l = m; } else { r = m; } } right = l; l = 0, r = y; while(l + 1 != r){ long long m = (l + r) / 2; if(ask(x, m)){ r = m; } else { l = m; } } up = l; l = y, r = n + 1; while(l + 1 != r){ long long m = (l + r) / 2; if(ask(x, m)){ l = m; } else { r = m; } } down = l; m = __gcd(right - left, down - up); right = left + m; down = up + m; x = (right + left) / 2 + 1; y = (down + up) / 2 + 1; if(m % 3 == 0){ if(ask(x, y + m / 3) == 0){ m /= 3; } } if(m % 5 == 0){ if(ask(x + m / 5, y) == 0){ m /= 5; } } right = left + m; down = up + m; x = (right + left) / 2 + 1; y = (down + up) / 2 + 1; while(ask(x - m, y - m) ){ x -= m; y -= m; } while(ask(x - 2 * m, y) ){ x -= 2 * m; } while(ask(x, y - 2 * m) ){ y -= m * 2; } printf("solution %d %d\n", x + 2 * m, y + 2 * m); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 492 KB | Output is correct |
2 | Correct | 2 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 492 KB | Output is correct |
2 | Correct | 5 ms | 500 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 524 KB | Output is correct |
2 | Correct | 3 ms | 524 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 524 KB | Output is correct |
2 | Correct | 3 ms | 524 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 524 KB | Output is correct |
2 | Correct | 2 ms | 524 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 524 KB | Output is correct |
2 | Correct | 3 ms | 524 KB | Output is correct |
3 | Correct | 2 ms | 524 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 524 KB | Output is correct |
2 | Correct | 3 ms | 556 KB | Output is correct |
3 | Correct | 2 ms | 556 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 556 KB | Output is correct |
2 | Correct | 3 ms | 556 KB | Output is correct |
3 | Correct | 3 ms | 556 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 556 KB | Output is correct |
2 | Correct | 3 ms | 556 KB | Output is correct |
3 | Correct | 3 ms | 556 KB | Output is correct |