Submission #1134933

#TimeUsernameProblemLanguageResultExecution timeMemory
1134933Hamed_GhaffariGap (APIO16_gap)C++20
0 / 100
2096 ms1096 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);
    ans = max(ans, x-lst);
    lst = y;
  }
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...