# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
40756 | Just_Solve_The_Problem | Gap (APIO16_gap) | C++11 | 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 <gap.h>
#define ll long long
#define pb push_back
ll findGap(int t, int n) {
ll left;
ll right;
left = 1;
right = 1e18;
ll mn, mx;
vector < ll > vec;
while (mn != mx) {
MinMax(left, right, mn, mx);
vec.pb(mn);
if (mn != mx)
vec.pb(mx);
}
sort(vec.begin(), vec.end());
ll ans = 0;
for (int i = 1; i < vec.size(); i++) {
ans = max(ans, vec[i] - vec[i - 1]);
}
return ans;
}