Submission #1113751

#TimeUsernameProblemLanguageResultExecution timeMemory
1113751MighilonA Light Inconvenience (CEOI23_light)C++17
0 / 100
3051 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){ for(int i=0;i<n;++i) a[i]+=v; b[0]=1; m=1; for(int i=0;i<n;++i){ ll x=b[m-1]; while(x*2+1<a[i]){ while(m>=2&&b[m-2]*2+1>=x) m--; b[m++]=x; } x=a[i]; while(m>=2&&b[m-2]*2+1>=x) m--; b[m++]=x; } memcpy(a,b,(n=m)*sizeof*b); } 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...