# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
671085 | AdamGS | 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 "gap.h"
#include<bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
const ll INF=1e18;
ll findGap(int t, int n) {
vector<ll>A, B;
ll mi=0, ma=INF;
while(true) {
ll *a, *b;
MinMax(mi, ma, a, b);
if(*a==-1) break;
A.pb(*a);
B.pb(*b);
mi=(*a)+1;
ma=(*b)-1;
}
reverse(all(B));
for(auto i : B) A.pb(i);
ll ans=0;
rep(i, A.size()-1) ans=max(ans, A[i+1]-A[i]);
return ans;
}