Submission #1318590

#TimeUsernameProblemLanguageResultExecution timeMemory
1318590khanhphucscratchGap (APIO16_gap)C++20
59.04 / 100
39 ms1184 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-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...