Submission #1134938

#TimeUsernameProblemLanguageResultExecution timeMemory
1134938Hamed_GhaffariGap (APIO16_gap)C++20
70 / 100
43 ms1212 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(ll 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...