이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <bits/stdc++.h>
#define bupol __builtin_popcount
//#define int long long
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
const int MAXN = 1e5+5;
const int MAXK = 205;
const int LOG = 20;
const int MOD = 1e9+7;
const int SQRT = 520;
const ll INF = 1e18;
typedef pair<ll,ll> pii;
typedef pair<ll,pii> ipii;
ll mn, mx;
int n;
set<ll> s; ll ans = -INF;
ll le, ri, nx;
long long findGap(int T, int N)
{
n = N;
MinMax(0, INF, &mn, &mx); le = mn; ri = mx;
s.insert(mn); s.insert(mx);
ll len = mx-mn-1, idx = mn;
for(ll i=1; i<=n-2; i++){ // n+1 segment
nx = len / (n-2) * i + le;
if(idx+1 <= nx){
//cout << idx+1 << ' ' << nx << " p\n";
MinMax(idx+1, nx, &mn, &mx);
s.insert(mn); s.insert(mx);
}
idx = nx;
}
nx = ri-1;
if(idx+1 <= nx){
//cout << idx+1 << ' ' << nx << " p\n";
MinMax(idx+1, nx, &mn, &mx);
s.insert(mn); s.insert(mx);
}
//for(auto in : s) cout << in << " xx\n";
auto it = s.begin(); ll las = -1;
while(it != s.end()){
if(las != -1) ans = max(ans, (*it)-las);
las = (*it); it++;
}
//for(auto in : s) cout << in << " in\n";
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |