제출 #959543

#제출 시각아이디문제언어결과실행 시간메모리
959543MinaRagy06Gap (APIO16_gap)C++17
12.76 / 100
40 ms3240 KiB
#include <bits/stdc++.h>
#include "gap.h"
#ifdef MINA
#include "grader.cpp"
#endif
using namespace std;
#define ll long long

const ll inf = 1e18;
ll findGap(int t, int n) {
	ll cur, mx;
	MinMax(0, inf, &cur, &mx);
	mx = 1;
	while (cur + mx + 1 < inf) {
		ll len = mx + 1, s = -1, e = -1;
		while (len < inf && e == -1) {
			MinMax(cur + 1, min(cur + len, inf), &s, &e);
			len *= 2;
		}
		if (s != -1) {
			mx = max(mx, s - cur);
		}
		if (e != -1) {
			cur = e;
		} else {
			cur = inf + 1;
		}
	}
	return mx;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...