# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
712699 | dungnguyenn_05 | Gap (APIO16_gap) | C++17 | 42 ms | 2660 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"
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
vector<ll> pre,suf;
long long findGap(int T, int N)
{
long long s=0,t=1e18;
ll mn,mx;
while(s<=t)
{
MinMax(s,t,&mn,&mx);
if(mn==-1) break;
pre.pb(mn);
suf.pb(mx);
s=mn+1;
t=mx-1;
}
reverse(all(suf));
for(ll x:suf)
pre.pb(x);
// for(int x:pre)
// cout<<x<<' ';
// cout<<endl;
ll res=0;
for(int i=1;i<pre.size();i++)
res=max(res,pre[i]-pre[i-1]);
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |