# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
713095 | | lam | Gap (APIO16_gap) | C++14 | | 41 ms | 1864 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>
#define ll long long
#include "gap.h"
using namespace std;
#define ll long long
const int maxn = 1e5 + 10;
int n;
ll a[maxn];
ll sub1()
{
int l=1; int r=n;
ll s = 0; ll t = 1e18;
while (l<=r)
{
ll *mx, *mn;
ll mmax, mmin;
mx = &mmax; mn = &mmin;
// cerr<<l<<' '<<r<<' '<<s<<' '<<t<<endl;
MinMax(s,t,mn,mx);
s = (mmin)+1; t = (mmax)-1;
a[l++]=mmin;
a[r--]=mmax;
}
ll ans = 0;
for (int i=2; i<=n; i++)
{
if (ans<a[i]-a[i-1]) ans=a[i]-a[i-1];
}
return ans;
}
ll findGap(int T, int N)
{
n=N;
if (T==1) return sub1();
else return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |