#include "light.h"
#include <bits/stdc++.h>
using namespace std;
long long slaves;
void prepare(){
slaves = 1;
}
pair<long long, vector<long long>> join( long long p ) {
slaves += p;
vector<long long> light;
for ( int l = 0; (1 << l) <= slaves; l++ )
light.push_back( slaves - (1 << l) + 1 );
reverse( light.begin(), light.end() );
return { p, light };
}
pair<long long, vector<long long>> leave( long long p ) {
slaves -= p;
vector<long long> light;
for ( int l = 0; (1 << l) <= slaves; l++ )
light.push_back( slaves - (1 << l) + 1 );
reverse( light.begin(), light.end() );
return { p, light };
}
# | 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... |