Submission #211726

#TimeUsernameProblemLanguageResultExecution timeMemory
211726quocnguyen1012Gap (APIO16_gap)C++14
30 / 100
96 ms9488 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...