Submission #295593

#TimeUsernameProblemLanguageResultExecution timeMemory
295593arayiGap (APIO16_gap)C++17
0 / 100
62 ms1280 KiB
#include <bits/stdc++.h>
#include "gap.h"
#define lli long long int
using namespace std;

int n;
long long findGap(int T, int N)
{
	n = N;
	lli nl, nr;
	MinMax(0, 1e18, &nl, &nr);
	lli ans = 1;
	while(nl < nr)
    {
        lli l, r;
        MinMax(nl + 1, nl + ans * 2 - 1, &l, &r);
        if(l == -1) ans = ans * 2;
        else ans = max(ans, l - nl), nl = r;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...