Submission #47771

#TimeUsernameProblemLanguageResultExecution timeMemory
47771ikura355Gap (APIO16_gap)C++14
57.64 / 100
79 ms11152 KiB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const ll inf = 2e18;

ll findGap(int T, int N) {
    ll L, R;
    MinMax(0,inf,&L,&R);
    ll all = R-L-1;
    ll sz = all/(N-1);
    ll last = L;
    ll ans = 0;
    for(ll x=L+1;x<R;x+=sz) {
        ll t1, t2;
        MinMax(x,min(R-1,x+sz),&t1,&t2);
        if(t1==-1) continue;
        ans = max(ans, t1-last);
        last = t2;
    }
    ans = max(ans, R-last);
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...