제출 #1035454

#제출 시각아이디문제언어결과실행 시간메모리
1035454adrielcpGap (APIO16_gap)C++17
0 / 100
41 ms2368 KiB
#include <bits/stdc++.h>
#include "gap.h"
#define ll long long
using namespace std;
#define alll(x) x.begin(), x.end()

long long findGap(int T, int n)
{
	vector<ll> a;
	ll l = 1, r = 1e18;
	ll mn, mx;
	for (int i = 0; i < (n+1)/2; i++) {
		MinMax(l, r, &mn, &mx);
		a.push_back(mn);
		a.push_back(mx);
		l = mn+1, r = mx-1;
	}
	sort(a.begin(), a.end());
	ll ans = 0;
	for (int i = 0; i < n-1; i++) ans = max(ans, a[i+1] - a[i]);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...