#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
long long findGap(int T, int N) {
int n = N;
if (T == 1) {
vector<ll> a;
ll mn = 0, mx = 1e9;
for (int i = 0; ; i++) {
MinMax(mn + 1, mx - 1, &mn, &mx);
if (mn == mx) a.emplace_back(mn);
else {
a.emplace_back(mn);
a.emplace_back(mx);
}
if (a.size() == n) break;
}
sort(a.begin(), a.end());
ll ans = 0;
for (int i = 0; i < a.size() - 1; i++) ans = max(ans, a[i + 1] - a[i]);
return ans;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |