이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 2;
ll findGap(int t, int n)
{
ll a[maxn];
if(t==1){
a[0] = -1;
a[n+1] = 2e18 + 1;
for(int i = 1, j = n; i <= j; i++,j--)
{
MinMax(a[i-1]+1,a[j+1]-1,&a[i],&a[j]);
}
ll res = 0;
for(int i = 1; i < n ; i++)
res = max(res,abs(a[i+1] - a[i]));
return res;
}
ll mn = 0,mx = 1e18;
MinMax(0,1e18,&mn,&mx);
ll gap = (mx - mn) / n;
ll Pre = -1;
ll res = 0;
if(n == 2) return mx - mn;
n--;
ll t1 = mn, t2 = mx;
for(ll be = t1; be < t2; be+= gap + 1)
{
MinMax(be, be + gap,&mn,&mx);
if(mn == -1)
continue;
if(Pre != -1)
res = max(res, mn - Pre+1);
Pre = mx;
}
return res;
}
//int main()
//{
//
//}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |