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 <bits/stdc++.h>
using namespace std;
long long n;
void prepare() {
n = 1;
}
pair<long long, vector<long long>> join(long long p) {
n += p;
vector<long long> ids;
for (int b = 0; b < 60; b++) {
long long f = (1LL << b);
if (n - f + 1 > 0) {
ids.push_back(n - f + 1);
}
}
for (int b = 0; b < 60; b++) {
long long f = (1LL << b);
if (f <= n) {
ids.push_back(f);
}
}
sort(ids.begin(), ids.end());
ids.erase(unique(ids.begin(), ids.end()), ids.end());
return {p, ids};
}
pair<long long, vector<long long>> leave(long long p) {
n -= p;
vector<long long> ids;
for (int b = 0; b < 60; b++) {
long long f = (1LL << b);
if (n - f + 1 > 0) {
ids.push_back(n - f + 1);
}
}
for (int b = 0; b < 60; b++) {
long long f = (1LL << b);
if (f <= n) {
ids.push_back(f);
}
}
sort(ids.begin(), ids.end());
ids.erase(unique(ids.begin(), ids.end()), ids.end());
return {p, ids};
}
# | 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... |