이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#include "gap.h"
long long findGap (int t, int n) {
if (t == 1) {
vector<long long> arr(n+1);
long long low = -1, high = 1e18+1;
for (int i = 1; i <= (n+1)/2; i++) {
MinMax(low+1,high-1,&low,&high);
arr[i] = low; arr[n-i+1] = high;
}
long long mx = 0;
for (int i = 1; i < n; i++) {
mx = max(mx,arr[i+1] - arr[i]);
}
return mx;
} else {
long long mx,mn;
MinMax(0,1e18,&mn,&mx);
long long go = max(1LL,(mx - mn) / n - 1), ret = 0, lstmx = -1;
for (long long cur = mn; cur <= mx; cur += go) {
long long ed = min(cur + go-1,mx);
long long low,high;
MinMax(cur,ed,&low,&high);
if (low != -1) {
if (~lstmx) ret = max(ret,low - lstmx);
lstmx = high;
}
}
return ret;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |