# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1110770 | TitanicXDzz | Gap (APIO16_gap) | C++14 | 44 ms | 4040 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>
using namespace std;
vector<long long> v;
long long findGap(int T, int n)
{
long long s=-1;
long long t=1e18+1;
long long x=-1;
long long y=-1;
long long maxi=LLONG_MIN;
for(int i=1;i<=n/2;i++){
MinMax(s+1,t-1,&s,&t);
v.push_back(t);
v.push_back(s);
}
if(n%2==1){
MinMax(s+1,t-1,&s,&t);
v.push_back(s);
}
int i=1;
long long xx;
sort(v.begin(),v.end());
for(auto a:v){
if(i!=1){
maxi=max(maxi,a-xx);
}
i++;
xx=a;
}
return maxi;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |