제출 #221332

#제출 시각아이디문제언어결과실행 시간메모리
221332zoooma13Gap (APIO16_gap)C++14
0 / 100
48 ms1272 KiB
#include "bits/stdc++.h" #include "gap.h" using namespace std; const long long MAX_A = 1e18; long long findGap(int T, int N){ long long lst = 0, mx_dist = 1; for(long long mn ,mx ,d=1; ; d<<=1){ MinMax(0 ,d ,&mn ,&mx); if(mn != -1){ lst = mn; break; } } for(int ok=1; ok; ) { for(long long mn,mx ,nxt=2*mx_dist; ok; nxt<<=1){ MinMax(lst+1 ,min(MAX_A ,lst+nxt) ,&mn ,&mx); if(lst+nxt >= MAX_A) ok = 0; if(mn != -1){ mx_dist = max(mx_dist ,mn-lst); lst = mx; break; } } } return mx_dist; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...