Submission #557925

#TimeUsernameProblemLanguageResultExecution timeMemory
557925Ai7081Gap (APIO16_gap)C++17
70 / 100
82 ms7336 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long

const ll inf = 1e18;

long long findGap(int T, int N)
{
    ll *allmin = new ll, *allmax = new ll;
    MinMax((ll)1, inf, allmin, allmax);
    ll gap = (*allmax - *allmin + N-2) / (N-1);
    ll now = *allmin+1, last = *allmin, ans=0;
    while (now < *allmax) {
        ll *mi = new ll, *ma = new ll;
        MinMax(now, now+gap, mi, ma);
        if (*mi != -1) ans = max(ans, *mi - last);
        if (*ma != -1) last = *ma;
        now = now+gap+1;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...