제출 #793087

#제출 시각아이디문제언어결과실행 시간메모리
793087algorithm16Gap (APIO16_gap)C++14
0 / 100
34 ms1104 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(1,(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) { /*cout << x << " " << x+r << "\n"; cin >> mn >> mx;*/ MinMax(1,x+r,&mn,&mx); if(mx!=x) { x=mx; continue; } llint lo=r,hi=rr; while(lo<hi) { llint mid=(lo+hi)/2; /*cout << x << " " << x+mid << "\n"; cin >> mn >> mx;*/ MinMax(1,x+mid,&mn,&mx); if(mx!=x) hi=mid; else lo=mid+1; } r=lo; x+=r; } return r; } /*int main() { cout << findGap(1,5); return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...