Submission #1318592

#TimeUsernameProblemLanguageResultExecution timeMemory
1318592khanhphucscratchGap (APIO16_gap)C++20
70 / 100
40 ms1204 KiB
#include "gap.h"
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int inf = 1e18;
long long findGap(int32_t T, int32_t n)
{
	int ans = 0, l, r;
	MinMax(1ll, inf, &l, &r);
    int step = (r-l-1+(n-2)) / (n-1), cur = l+1, last = l;
    while(cur < r){
        int x, y; MinMax(cur, min(cur+step-1, r-1), &x, &y);
        if(x > -1){
            ans = max(ans, x - last);
            last = y;
        }
        cur += step;
    }
    ans = max(ans, r-last);
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...