Submission #1029893

#TimeUsernameProblemLanguageResultExecution timeMemory
1029893MuhammetGap (APIO16_gap)C++17
70 / 100
48 ms2856 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; #define ll long long #define sz(s) (int)s.size() ll findGap(int T, int n){ ll s = 0, t = 1e18, mn, mx; MinMax(s, t, &mn, &mx); ll d = ((mx - mn + n - 2) / (n - 1)), k = mn, ans = d, m = mx, ind = 0; for(ll i = mn+1; i + d < m; i += (d + 1)){ MinMax(i, i + d, &mn, &mx); if(mn != -1){ ans = max(ans, mn-k); } if(mx != -1){ k = mx; } ind = i; } ind += d; ll x; MinMax(ind+1,m-1,&mn,&x); if(mn != -1) ans = max(ans, mn-k); if(x == -1){ ans = max(ans,m-k); } else { ans = max(ans,m-x); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...