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"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
set<ll> res;
int n;
void solve1(ll L, ll R) {
if((int)res.size()==n||L>R) return ;
ll a,b;
MinMax(L,R,&a,&b);
if(a==-1) return ;
res.insert(a);
res.insert(b);
solve1(a+1,b-1);
}
void add(ll L, ll R) {
if((int)res.size()==n||L>R) return ;
ll a,b;
MinMax(L,R,&a,&b);
if(a==-1) return ;
res.insert(a);
res.insert(b);
}
ll findGap(int T, int N)
{
n=N;
solve1(0, 1000000000000000000LL);
vector<ll> ans;
for(auto i:res) ans.push_back(i);
ll val=0;
for(int i=1;i<(int)ans.size();++i) val=max(val, ans[i]-ans[i-1]);
return val;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |