This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |