Submission #156647

#TimeUsernameProblemLanguageResultExecution timeMemory
156647a_playerGap (APIO16_gap)C++14
0 / 100
2081 ms524292 KiB
#include <bits/stdc++.h> #include "gap.h" #define f first #define s second #define mp make_pair #define pb push_back using namespace std; typedef long long ll; ll mas=0LL; ll vv[100001]; int k=0; int N; void ric(ll a,ll b){ ll u,v; MinMax(a,b,&u,&v); if(u==-1&&v==-1)return; if(u==v){vv[k++]=u; return;} ll pivot=(v-u)/(N-k); int ini=u; for(int i=0;i<N-k-1;i++){ pivot=max(1LL,(v-ini)/(N-k)); ric(ini,ini+max(0LL,pivot-1)); ini+=pivot; } if(ini<v)ric(ini,v); } int findGap(int T,int N){ ::N=N; if(T==2){ ric(0LL,1000000000000000000LL); for(int i=0;i<N-1;i++)mas=max(mas,vv[i+1]-vv[i]); return mas; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...