제출 #29250

#제출 시각아이디문제언어결과실행 시간메모리
29250samir_droubiNizovi (COI14_nizovi)C++14
80 / 100
73 ms5928 KiB
#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); }

컴파일 시 표준 에러 (stderr) 메시지

nizovi.cpp: In function 'int bs(int, int)':
nizovi.cpp:17:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&x);
                           ^
nizovi.cpp: In function 'int main()':
nizovi.cpp:30:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&n,&N);
                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...