제출 #1104425

#제출 시각아이디문제언어결과실행 시간메모리
1104425codexistentGap (APIO16_gap)C++14
70 / 100
46 ms2876 KiB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
 
long long findGap(int T, int N) {
	ll mn, mx;
	MinMax(1, 1e18, &mn, &mx);
	ll step = (mx - mn) / (N - 1);
	ll ans = step, x, y, l = mn, i;
	for (i = mn; i + step < mx; i += step + 1) {
		MinMax(i, i + step, &x, &y);
		if (x != -1) {
			ans = max(ans, x - l);
			l = y;
		}
	}
	MinMax(i, mx, &x, &y);
	if (x != -1) ans = max(ans, x - l);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...