# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
29247 | 2017-07-18T20:02:57 Z | samir_droubi | Nizovi (COI14_nizovi) | C++14 | 89 ms | 5928 KB |
#include <bits/stdc++.h> using namespace std; int n,N; const int mxn=(1e6)+(1e3)+5; int id[mxn]; int bs(int i,int j) { int in=-1; int l=j; int r=n+N; while(l<=r) { int md=(l+r)/2; printf("cmp %d %d\n",md,i); fflush(stdout); int x; scanf("%d",&x); if(x<=0) { in=md; l=md+1; } else r=md-1; } return in; } int main() { scanf("%d%d",&n,&N); int c=n; int in=1; while(c) { int x = bs( in, in + c ); if(x==-1) { --c; ++in; continue; } if( x > in ) printf("reverse %d %d\n", in, x); fflush(stdout); if( x - c > in ) printf("reverse %d %d\n", in, x - c ); fflush(stdout); if( x > x - c + 1 ) printf("reverse %d %d\n", x - c + 1, x); fflush(stdout); in = x - c + 1; } puts("end"); fflush(stdout); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 5928 KB | Output is correct |
2 | Correct | 3 ms | 5928 KB | Output is correct |
3 | Correct | 0 ms | 5928 KB | Output is correct |
4 | Correct | 9 ms | 5928 KB | Output is correct |
5 | Correct | 16 ms | 5928 KB | Output is correct |
6 | Correct | 9 ms | 5928 KB | Output is correct |
7 | Correct | 59 ms | 5928 KB | Output is correct |
8 | Runtime error | 66 ms | 5928 KB | Execution timed out (wall clock limit exceeded) |
9 | Correct | 89 ms | 5928 KB | Output is correct |
10 | Runtime error | 79 ms | 5928 KB | Execution timed out (wall clock limit exceeded) |