제출 #384989

#제출 시각아이디문제언어결과실행 시간메모리
384989thecodingwizardGap (APIO16_gap)C++11
0 / 100
75 ms1260 KiB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

#define f first
#define s second
#define ll long long
#define ii pair<ll, ll>

ii get(ll a, ll b) {
    b = min(b, (ll)1e18);
    ii x;
    MinMax(a, b, &x.f, &x.s);
    return x;
}

long long findGap(int T, int N)
{
    ii boundary = get(1, 1e18);
    ll block = (boundary.s-boundary.f)/(N-1);
    ll prev = boundary.f;

    ll ans = 0;
    for (ll cur = boundary.f + 1; cur < boundary.s; cur += block) {
        ii thing = get(cur, cur+block);
        ans = max(ans, thing.f - prev);
        prev = thing.s;
    }

    ans = max(ans, boundary.s - prev);

    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...