제출 #295605

#제출 시각아이디문제언어결과실행 시간메모리
295605arayiGap (APIO16_gap)C++17
0 / 100
59 ms1272 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 - 1)
    {
        lli l, r;
        MinMax(nl + 1, min(nr - 1, nl + ans * 2 - 1LL), &l, &r);
        if(l == -1) ans = ans * 2LL;
        else ans = max(ans, l - nl), nl = r;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...