이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define ff first
#define ss second
//#define endl "\n"
#define pb push_back
#define F(i,a,b) for(ll i=a;i<=b;i++)
const ll maxn=1e3+5e2+100;
const ll base=2e9;
const ll mod= 1e9+7 ;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
ll findGap(int t,int n)
{
if (t==1)
{
ll l=-1,h=1e18+1;
vector<ll> vt;
vector<ll> vt1;
ll mn,mx;
ll res=0;
for (int i=1; i<=(n+1)/2; i++)
{
MinMax(l+1,h-1,&mn,&mx);
vt.pb(mn);
vt1.pb(mx);
l=mn;
h=mx;
}
reverse(vt1.begin(),vt1.end());
for (auto to:vt1)
vt.pb(to);
for (int i=1; i<(ll)vt.size(); i++)
res=max(res,vt[i]-vt[i-1]);
return res;
}
else
{
ll mn,mx;
MinMax(0,1e18,&mn,&mx);
ll len=mx-mn;
ll pt=mx;
ll h=(len+n-1)/(n);
h--;
ll l=mn;
ll pre=base;
ll res=0;
while (1)
{
MinMax(l,l+h,&mn,&mx);
l+=(h+1);
if (mn!=-1)
{
res=max(res,mn-pre);
pre=mx;
if (mx==pt)
{
break;
}
}
else
{
}
}
return res;
}
}
/*int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
if (fopen("t.inp","r"))
{
freopen("test.inp","r",stdin);
freopen("test.out","w",stdout);
}
ll n;
cin>>n;
initialize(n);
for (int i=1;i<=n;i++)
{
}
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |