Submission #1113753

#TimeUsernameProblemLanguageResultExecution timeMemory
1113753MighilonA Light Inconvenience (CEOI23_light)C++17
0 / 100
3066 ms336 KiB
#include "light.h" #include <cstring> #include <vector> using namespace std; #ifdef DEBUG #include "../Library/debug.h" #else #define dbg(x...) #endif typedef long long ll; int n,m; ll a[150],b[150]; void prepare(){ a[0]=1; n=1; } void update(ll v){ dbg(1) dbg(n) for(int i=0;i<n;++i) a[i]+=v; b[0]=1; m=1; for(int i=0;i<n;++i){ ll x=2*b[m-1]+1; while(x<a[i]){ while(m>=2&&b[m-2]*2+1>=x) m--; b[m++]=x; x=b[m-1]*2+1; } x=a[i]; while(m>=2&&b[m-2]*2+1>=x) m--; b[m++]=x; } memcpy(a,b,(n=m)*sizeof*b); dbg(2) } vector<ll> query(){ vector<ll> res(n); for(int i=0;i<n;++i) res[i]=a[n-1]-a[n-1-i]+1; return res; } std::pair<long long, std::vector<long long>> join(long long p){ update(p); return {p,query()}; } std::pair<long long, std::vector<long long>> leave(long long p){ update(-p); return {p,query()}; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...