# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
237511 | thtsshz_bgwrswh | Gap (APIO16_gap) | C++17 | 71 ms | 2296 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.
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<vector>
#include<assert.h>
#include<algorithm>
#include "gap.h"
using namespace std;
vector<long long> num;
long long findGap(int T,int N){
if(T==1){
long long i,maxv=1000000000000000000,minv=0,ans,ans2;
while(maxv>=minv&&num.size()<N){
MinMax(minv,maxv,&ans,&ans2);
if(ans==-1||ans2==-1)
break;
if(ans==ans2){
num.emplace_back(ans);
break;
}
num.emplace_back(ans);
num.emplace_back(ans2);
maxv=ans2-1;
minv=ans+1;
}
sort(num.begin(),num.end());
assert(num.size()==N);
ans=0;
for(i=1;i<num.size();i++)
ans=max(ans,num[i]-num[i-1]);
return ans;
}
else{
return 0;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |