# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
132459 | 2019-07-18T21:36:40 Z | dragonslayerit | Aliens (IOI07_aliens) | C++14 | 4 ms | 376 KB |
#include <cstdio> #include <cstring> long long N; bool examine(long long x,long long y){ if(x<1||x>N||y<1||y>N) return false; printf("examine %lld %lld\n",x,y); fflush(stdout); char response[16]; scanf("%s",response); return !strcmp(response,"true"); } //distance to nearest non-flattened long long search(long long x,long long y,long long dx,long long dy){ long long low=0,high=1; while(examine(x+high*dx,y+high*dy)){ high*=2; } while(high-low>1){ long long mid=(low+high)/2; if(examine(x+mid*dx,y+mid*dy)){ low=mid; }else{ high=mid; } } return high; } int main(){ long long X,Y; scanf("%lld %lld %lld",&N,&X,&Y); long long up=search(X,Y,0,1); long long down=search(X,Y,0,-1); long long M=up+down-1; Y+=(up-down)/2; long long left=search(X,Y,-1,0); long long right=M+1-left; X+=(right-left)/2; //printf("(%lld,%lld) M=%lld\n",X,Y,M); for(long long i=4;i>=0;i--){ for(long long j=4;j>=0;j--){ if(examine(X-i*M,Y-j*M)){ printf("solution %lld %lld\n",X-i*M+2*M,Y-j*M+2*M); return 0; } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 252 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 248 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 248 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 172 KB | Output is correct |
3 | Correct | 4 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 248 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 248 KB | Output is correct |
3 | Correct | 3 ms | 296 KB | Output is correct |