제출 #793122

#제출 시각아이디문제언어결과실행 시간메모리
793122algorithm16Gap (APIO16_gap)C++14
0 / 100
38 ms1112 KiB
#include "gap.h" #include<iostream> using namespace std; typedef long long int llint; llint findGap(int T, int N) { llint mn,mx; /*cout << 1 << " " << 1e18 << "\n"; cin >> mn >> mx;*/ MinMax(1LL,(llint)1e18,&mn,&mx); llint x=mn,y=mx,rr=mx-mn,r=(mx-mn)/(N-1)+((mx-mn)%(N-1)!=0); while(x!=y) { if(y-x<=r) break; /*cout << x << " " << x+r << "\n"; cin >> mn >> mx;*/ MinMax(x+1,x+r,&mn,&mx); if(mx!=-1) { x=mx; continue; } llint lo=r,hi=min(y-x,r*3/2); while(lo<hi) { llint mid=(lo+hi)/2; /*cout << x << " " << x+mid << "\n"; cin >> mn >> mx;*/ MinMax(x+1,x+mid,&mn,&mx); if(mx!=-1) hi=mid; else lo=mid+1; } if(lo<2*r) x+=lo; r=lo; } return r; } /*int main() { cout << findGap(1,5); return 0; }*/

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

gap.cpp: In function 'llint findGap(int, int)':
gap.cpp:11:18: warning: unused variable 'rr' [-Wunused-variable]
   11 |  llint x=mn,y=mx,rr=mx-mn,r=(mx-mn)/(N-1)+((mx-mn)%(N-1)!=0);
      |                  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...