Submission #1134936

#TimeUsernameProblemLanguageResultExecution timeMemory
1134936Hamed_GhaffariGap (APIO16_gap)C++20
0 / 100
2097 ms1192 KiB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

using ll = long long;

long long findGap(int T, int N) {
  ll mn, mx;
  MinMax(0, 1e18, &mn, &mx);
  ll lb = (mx-mn+N-2)/(N-1);
  ll ans = lb, lst=mn;
  for(int i=mn; i<=mx; i += lb+1) {
    ll x, y;
    MinMax(i, min(i+lb, mx), &x, &y);
    if(x!=-1) {
      ans = max(ans, x-lst);
      lst = y;
    }
  }
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...