제출 #632798

#제출 시각아이디문제언어결과실행 시간메모리
632798dozerGap (APIO16_gap)C++14
59.04 / 100
55 ms1188 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;

long long findGap(int T, int N)
{
	long long l, r;
	MinMax(1, 1e18, &l, &r);
	long long lim = (r - l) / N;
	long long ans = lim, curr = l;
	while(curr < r - 1)
	{
		long long a, b;
		MinMax(curr + 1, min(curr + lim, r - 1), &a, &b);
		if (a == -1) curr += lim;
		else
		{
			ans = max(ans, a - l);
			l = b;
			curr += lim;
		}
	}
	ans = max(ans, r - l);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...