제출 #1029829

#제출 시각아이디문제언어결과실행 시간메모리
1029829stdfloatGap (APIO16_gap)C++17
59.04 / 100
48 ms3276 KiB
#include <bits/stdc++.h>
#include "gap.h"
// #include "grader.cpp"
using namespace std;

using ll = long long;

ll findGap(int T, int n) {
	ll s, t;
	MinMax(0, (ll)1e18, &s, &t);

	ll d = (t - s - 1) / (n - 1);
	vector<ll> v = {s};
	while (s + 1 < t) {
		ll x, y;
		MinMax(s + 1, min(s + d, t - 1), &x, &y);

		if (x != -1) v.insert(v.end(), {x, y});		

		s += d;
	}

	ll mx = 0;
	for (int i = 1; i < (int)v.size(); i++) mx = max(mx, v[i] - v[i - 1]);

	return max(mx, t - v.back());
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...