# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
553348 | urosk | Gap (APIO16_gap) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "gap.h"
// __builtin_popcount(x)
// __builtin_popcountll(x)
#define here cerr<<"===========================================\n"
#include <bits/stdc++.h>
#define ld double
#define ll long long
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
using namespace std;
ll n;
ll findGap(ll T, ll N)
{
n = N;
if(t==1){
ll l = 1,r = 1000000000;
r*=r;
vector<ll> v;
while(l<=r){
ll x,y;
MinMax(l,r,x,y);
if(x==-1&&y==-1) break;
if(x==y){
v.pb(x);
break;
}else{
v.pb(x);
v.pb(y);
r = y-1;
l = x+1;
}
}
sort(all(v));
ll ans = 0;
for(ll i = 0;i<sz(v)-1;i++){
ans = max(ans,v[i+1]-v[i]);
}
return ans;
}
return 0;
}