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>
#define int long long
using namespace std;
template<typename T>
inline bool maxi(T &x, const T &val)
{
if (x < val) return x = val, true;
return false;
}
template<typename T>
inline bool mini(T &x, const T &val)
{
if (x > val) return x = val, true;
return false;
}
const int maxn = 1e5 + 10, oo = 1e18;
int n;
int a[maxn];
int res;
void MinMax(long long s, long long t, long long *mn, long long *mx);
int solve1()
{
int st = 0, en = oo;
int *tmpn = new int(0), *tmpx = new int(oo);
int curst = 1, curen = n;
while (curst <= curen) {
MinMax(st, en, tmpn, tmpx);
a[curst++] = *tmpn;
st = *tmpn + 1;
a[curen--] = *tmpx;
en = *tmpx - 1;
}
for (int i = 1; i < n; i++) {
maxi(res, a[i + 1] - a[i]);
}
return res;
}
int solve2()
{
}
int findGap(signed sub, signed n)
{
::n = n;
if (sub == 1) return solve1();
else return solve2();
}
#undef int
Compilation message (stderr)
gap.cpp: In function 'long long int solve2()':
gap.cpp:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
48 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |