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;
#define ll long long
#define sz(s) (int)s.size()
ll findGap(int T, int n){
vector <ll> v, v1;
for(int i = 0; i < (n+1)/2; i++){
ll s, t, mn, mx;
if(i == 0) s = 0, t = 1e18;
else s = v.back()+1, t = v1.back()-1;
if(s > t) break;
MinMax(s, t, &mn, &mx);
v.push_back(mn);
v1.push_back(mx);
}
if(n % 2 == 1) v1.pop_back();
while(sz(v1) > 0){
v.push_back(v1.back());
v1.pop_back();
}
ll ans = 0;
for(int i = 0; i < n-1; i++){
ans = max(ans, v[i+1]-v[i]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |