이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "gap.h"
using namespace std;
using namespace __gnu_pbds;
#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
#define MAXN 100005
ll mn,mx;
ll findGap(int T, int n)
{
if(T==1)
{
ll L=0,R=1e18;
ll a[n];
for(int i=0;i<(n+1)/2;i++){
MinMax(L,R,&mn,&mx);
a[i]=mn, a[n-1-i]=mx;
L=mn+1, R=mx-1;
}
ll ans=0;
forn(i,0,n-1) ans=max(ans, a[i+1]-a[i]);
return ans;
}
else
{
ll L,R,ans=0;
MinMax(0,1e18,&L,&R);
ll len=(R-L+n-2)/(n-1);
ll pre=L;
for(ll i=L+1;i<=R;i+=len+1){
MinMax(i,i+len,&mn,&mx);
if(mn!=-1){
ans=max(ans, mn-pre);
pre=mx;
}
}
return ans;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |