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"
using namespace std;
using ll = long long;
long long findGap(int T, int N)
{
ll cep,sag;
MinMax(1,(ll)1e18,&cep,&sag);
vector<ll>v;
v.push_back(cep);
v.push_back(sag);
while(cep < sag - 1 and (int)v.size() < N){
ll cp,sg;
MinMax(cep+1,sag-1,&cp,&sg);
if(cp != -1){
v.push_back(cp);
if(cp == sg) break;
v.push_back(sg);
cep = cp;
sag = sg;
}
}
sort(v.begin(),v.end());
ll ans = 0;
for(int i = 1;i < (int)v.size();i++) ans = max(ans,v[i] - v[i - 1]);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |