Submission #1174126

#TimeUsernameProblemLanguageResultExecution timeMemory
1174126LucaIlieA Light Inconvenience (CEOI23_light)C++20
0 / 100
164 ms408 KiB
#include "light.h"
#include <bits/stdc++.h>

using namespace std;

const int ADD = 1;
long long slaves;

void prepare(){
	slaves = 1;
}

vector<long long> getLight() {
    vector<long long> light;
    light.push_back( slaves );
    for ( int l = 0; (1LL << l) < slaves; l++ )
        light.push_back( slaves - (1LL << l) );
    for ( int l = 0; (1LL << l) <= slaves; l++ )
        light.push_back( 1LL << l );
    sort( light.begin(), light.end() );
    light.resize( unique( light.begin(), light.end() ) - light.begin() );
    return light;
}

pair<long long, vector<long long>> join( long long p ) {
    slaves += p;
    return { p, getLight() };
}

pair<long long, vector<long long>> leave( long long p ) {
    slaves -= p;
    return { p, getLight() };
}

#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...