# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973479 | Halym2007 | Gap (APIO16_gap) | C++17 | 0 ms | 0 KiB |
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;
#define ll long long
#define pb push_back
#define sz size()
ll findGap(int T, int N) {
if (T == 1) {
vector <ll> v;
ll l = 0, r = 1e18, mn = 100, mx = 100;
while (1) {
MinMax (l, r, mn, mx);
ll x = mn, y = mx;
if (x == y) {
v.pb (x);
break;
}
else {
v.pb (x);v.pb (y);
}
l = x + 1;r = y - 1;
}
ll jog = 0;
sort (v.begin(), v.end());
assert (N == (int)v.sz);
for (int i = 1; i < (int)v.sz; ++i) {
jog = max (jog, v[i] - v[i - 1]);
}
return jog;
}
return 0;
}