Submission #47938

#TimeUsernameProblemLanguageResultExecution timeMemory
479383zpGap (APIO16_gap)C++14
56.31 / 100
87 ms1532 KiB
#include "gap.h" #define ll long long #include<bits/stdc++.h> using namespace std; long long findGap(int T, int N) { ll s, t; MinMax(0, 1e18, &s, &t); ll L = t - s; ll d = L / (N - 1); ll ans = d; ll x = s; while(x != t){ ll p, q; MinMax(x + 1, x + d, &p , &q); if(q != -1) { x = q; continue; } int w = 2; while(1){ MinMax(x + 1,min( x + w * d, (ll)1e18),&p , &q); if(q == -1) {w++; continue;} ans = max(ans, p - x); x = q; break; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...