Submission #221351

#TimeUsernameProblemLanguageResultExecution timeMemory
221351zoooma13Gap (APIO16_gap)C++14
12.76 / 100
63 ms1272 KiB
#include "bits/stdc++.h" #include "gap.h" //#include "grader.cpp" using namespace std; long long MAX_A = 1e18; long long findGap(int T, int N){ long long lst = 0, mx_dist = 1; if(N <= 60) MinMax(0 ,1e18 ,&lst ,&MAX_A); else 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=mx_dist+1; 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...