This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 1e5 + 10;
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define fillchar(a, s) memset((a), (s), sizeof(a))
int N;
ll A[MAXN];
ll findGap (int subtask, int nnn) {
N = nnn;
for (int i = 1, j = N; i <= j; i++, j--) {
ll mn, mx;
if (i == 1) {
mn = 0;
mx = 1e18;
} else {
mn = A[i - 1] + 1;
mx = A[j + 1] - 1;
}
MinMax(mn, mx, &mn, &mx);
A[i] = mn;
A[j] = mx;
}
ll ans = 0;
for (int i = 2; i <= N; i++) {
ans = max(ans, A[i] - A[i - 1]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |