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<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll find_gap1(int n){
vector<ll>vec1,vec2;
ll l=0,r=1e18;
while(true){
MinMax(l,r,&l,&r);
if(l==r){
if(l!=-1)
vec1.push_back(l);
break;
}
vec1.push_back(l);
vec2.push_back(r);
l++;
r--;
}
reverse(vec2.begin(),vec2.end());
vec1.insert(vec1.end(),vec2.begin(),vec2.end());
ll res=1e18;
for(int i=1;i<n;i++)
res=min(res,vec1[i]-vec1[i-1]);
return res;
}
ll find_gap2(int n){
return 0;
}
ll findGap(int t,int n){
if(t==1){
return find_gap1(n);
}else{
return find_gap2(n);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |