#include "light.h"
#include <bits/stdc++.h>
using namespace std;
long long pw[65], cnt;
void prepare(){
pw[0]=cnt=1;
for (int i=1; i<65; i++) pw[i]=pw[i-1]*2;
}
vector<long long> solve()
{
set<long long> s;
s.insert(1);
for (int i=0; i<60; i++)
{
if (pw[i]>cnt) break;
long long cur=(cnt/pw[i])*pw[i];
s.insert(cur);
if (cur-pw[i]>=1) s.insert(cur-pw[i]);
if (cur-2*pw[i]>=1) s.insert(cur-2*pw[i]);
if (((cur%pw[i+1])==0)&&cur-3*pw[i]>=1) s.insert(cur-3*pw[i]);
}
vector<long long> res;
for (auto x:s) res.push_back(x);
return res;
}
std::pair<long long, std::vector<long long>> join(long long p){
cnt+=p;
return {p, solve()};
}
std::pair<long long, std::vector<long long>> leave(long long p){
cnt-=p;
return {p, solve()};
}
# | 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... |