이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "light.h"
#include <bits/stdc++.h>
using namespace std;
long long tot;
vector<long long> vec;
void prepare(){
tot = 1;
vec.push_back(1);
}
pair<long long, vector<long long>> join(long long p){
tot += p;
for (int i = 0; i < (int) vec.size(); ++i) {
vec[i] += p;
}
vector<long long> new_vec;
for (long long x = 1; x <= tot; ) {
new_vec.push_back(x);
if (x == tot) {
break;
}
auto next_one = upper_bound(vec.begin(), vec.end(), 2 * x) - vec.begin();
if (next_one != (int) vec.size() && vec[next_one] - p <= x * 2) {
x = x * 2;
} else {
x = vec[next_one - 1];
}
}
vec = new_vec;
return {p, vec};
}
pair<long long, vector<long long>> leave(long long p){
tot -= p;
for (int i = 0; i < (int) vec.size(); ++i) {
vec[i] -= p;
}
vector<long long> new_vec;
for (long long x = 1; x <= tot; ) {
new_vec.push_back(x);
if (x == tot) {
break;
}
auto next_one = upper_bound(vec.begin(), vec.end(), 2 * x) - vec.begin();
if (next_one != (int) vec.size() && vec[next_one] - p <= x * 2) {
x = x * 2;
} else {
x = vec[next_one - 1];
}
}
vec = new_vec;
return {p, vec};
}
# | 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... |