# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973476 | 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, x = 1, y = 1;
while (1) {
MinMax (l, r, x, y);
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;
}