이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "light.h"
#include <cstring>
#include <vector>
using namespace std;
const int N = 150;
typedef vector<long long> vl;
typedef pair<long long, vl> plvl;
long long xx[N], xx_[N]; int n, n_;
void prepare() {
n = 0;
xx[n++] = 1;
}
void update(long long d) {
for (int i = 0; i < n; i++)
xx[i] += d;
n_ = 0;
xx_[n_++] = 1;
for (int i = 0; i < n; i++) {
if (xx[i] <= xx_[n_ - 1])
continue;
long long x;
while ((x = xx_[n_ - 1] * 2 + 1) < xx[i]) {
while (n_ >= 2 && xx_[n_ - 2] * 2 + 1 >= x)
n_--;
xx_[n_++] = x;
}
x = xx[i];
while (n_ >= 2 && xx_[n_ - 2] * 2 + 1 >= x)
n_--;
xx_[n_++] = x;
}
memcpy(xx, xx_, (n = n_) * sizeof *xx_);
}
vl query() {
vl aa(n);
for (int i = 0; i < n; i++)
aa[i] = xx[n - 1] - xx[n - 1 - i] + 1;
return aa;
}
plvl join(long long d) {
update(d);
return { d, query() };
}
plvl leave(long long d) {
update(-d);
return { d, query() };
}
| # | 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... |