Submission #1092468

#TimeUsernameProblemLanguageResultExecution timeMemory
1092468alexander707070Gap (APIO16_gap)C++14
0 / 100
24 ms2816 KiB
#include<bits/stdc++.h> #include "gap.h" #define MAXN 600007 using namespace std; struct interval{ long long from,to; inline friend bool operator < (interval fr,interval sc){ return fr.to-fr.from<sc.to-sc.from; } }; priority_queue<interval> q; interval check(long long l,long long r){ if(l+1==r)return {-1,-1}; long long mid=(l+r)/2; long long *ll,*rr,*lt,*rt; ll=new long long(); rr=new long long(); lt=new long long(); rt=new long long(); MinMax(l+1,mid, ll,rr); MinMax(mid,r-1, lt,rt); return {*rr,*lt}; } const long long inf=1e18; long long *l,*r; long long findGap(int T, int N){ while(!q.empty())q.pop(); l=new long long(); r=new long long(); MinMax(1, inf, l,r); q.push({*l,*r}); return 0; while(true){ interval s=check(q.top().from,q.top().to); if(s.from==-1)return q.top().to-q.top().from; interval z=q.top(); q.pop(); q.push({z.from,s.from}); if(s.from!=s.to)q.push(s); q.push({s.to,z.to}); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...