# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1196031 | FIFI_cpp | A Light Inconvenience (CEOI23_light) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <fstream>
#include <iterator>
#include <set>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cctype>
#include <string>
#include <cassert>
#include <set>
#include <bitset>
#include <unordered_set>
#include <numeric>
#define all(a) a.begin(), a.end()
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppi pair<int,pair<int,int>>
#define int int64_t
#define ll long long
using namespace std;
vector<int> positions;
int sz = 1;
void prepare(){
positions.clear();
positions = {1};
}
std::pair<long long, std::vector<long long>> join(long long p){
sz += p;
positions.clear();
int x = 1;
while (x <= sz)
{
positions.pb(sz - x + 1);
x *= 2;
}
reverse(all(positions));
pair<ll, vector<ll>> res = {p, positions};
return res;
}
std::pair<long long, std::vector<long long>> leave(long long p){
sz -= p;
positions.clear();
int x = 1;
while (x <= sz)
{
positions.pb(sz - x + 1);
x *= 2;
}
reverse(all(positions));
pair<ll, vector<ll>> res = {p, positions};
return res;
}