# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169782 | ZwariowanyMarcin | Gap (APIO16_gap) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "gap.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define ss(x) (int) x.size()
#define pb push_back
#define ll long long
#define cat(x) cerr << #x << " = " << x << endl
#define FOR(i, n) for(int i = 0; i < n; ++i)
using namespace std;
void MinMax(ll L, ll R, ll *LL, ll *RR) {
}
ll findGap(int t, int n) {
if(t == 1) {
vector <ll> v;
ll L = 0;
ll R = 1e18;
while(L <= R) {
ll LL, RR;
MinMax(L, R, &LL, &RR);
if(LL == -1) break;
v.pb(LL);
if(LL != RR)
v.pb(RR);
L = LL + 1;
R = RR - 1;
}
sort(v.begin(), v.end());
ll ans = 0;
for(int i = 0; i + 1 < ss(v); ++i)
ans = max(ans, v[i + 1] - v[i]);
return ans;
}
// t = 2
ll L = 0;
ll R = 1e18;
ll LL, RR;
MinMax(L, R, &LL, &RR);
ll ans = (RR - LL + n - 2) / (n - 1);
ll Last = -1;
L = LL;
R = RR;
ll P = ans;
while(L <= R) {
MinMax(L, L + P, &LL, &RR);
if(LL == -1) {
L += P + 1;
continue;
}
if(Last != -1) {
ans = max(ans, LL - Last);
}
Last = RR;
L += P + 1;
}
return ans;
}
int main() {
return 0;
}