제출 #106946

#제출 시각아이디문제언어결과실행 시간메모리
106946kekGap (APIO16_gap)C++14
30 / 100
76 ms2444 KiB
#include "gap.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

// #define int ll
#define all(v) v.begin(), v.end()
#define len(v) ((int)(v).size())
#define pb push_back
#define kek pop_back
#define pii pair<int, int>
#define mp make_pair

#define debug(x) cout << #x << " = " << x << endl;

const int INF = 1e9 + 666;

template<class t1, class t2>
bool cmin(t1 &a, const t2 &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class t1, class t2>
bool cmax(t1 &a, const t2 &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

// void MinMax(ll, ll, ll*, ll*);

ll findGap(int t, int n) {
	vector<ll> a;
	ll l = 0, r = 1e18;
	while (len(a) < n) {
		MinMax(l, r, &l, &r);
		if (l == -1) {
			break;
		}
		a.pb(l);
		if (l != r) {
			a.pb(r);
		}
		++l;
		--r;
	}
	sort(all(a));
	ll ans = 0;
	for (int i = 0; i + 1 < len(a); ++i) {
		cmax(ans, a[i + 1] - a[i]);
	}
	return ans;
}

// void run();

// signed main() {
// 	iostream::sync_with_stdio(0);
// 	cin.tie(0);
// 	cout.tie(0);
// 	run();
// }

// void run() {
// }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...