# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
826752 | amsraman | Digital Circuit (IOI22_circuit) | C++17 | 920 ms | 31300 KiB |
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 <bits/stdc++.h>
using namespace std;
template <class B>
struct LazySegTree : public B {
using T_q = typename B::T_q;
using T_u = typename B::T_u;
int n, sz, log; vector<T_q> seg; vector<T_u> lazy;
LazySegTree(int n = 0): n(n), log(__lg(max(n - 1, 1)) + 1) {
sz = (1 << log), seg.resize(sz << 1, B::e_q), lazy.resize(sz << 1, B::e_u);
}
LazySegTree(vector<T_q> & init): n((int) init.size()), log(__lg(max(n - 1, 1)) + 1) {
sz = (1 << log), seg.resize(sz << 1, B::e_q), lazy.resize(sz << 1, B::e_u);
copy(init.begin(), init.end(), seg.begin() + sz);
for(int i = sz - 1; i > 0; i--) refresh(i);
}
void refresh(int ind) {
seg[ind] = B::comb(seg[2 * ind], seg[2 * ind + 1]);
}
void app(int ind, int lo, int hi, T_u delta) {
seg[ind] = B::upd(seg[ind], delta, lo, hi);
lazy[ind] = B::comb_upd(delta, lazy[ind]);
}
void push(int ind, int lo, int hi) {
if(lo != hi) {
int mid = (lo + hi) >> 1;
app(2 * ind, lo, mid, lazy[ind]);
app(2 * ind + 1, mid + 1, hi, lazy[ind]);
}
Compilation message (stderr)
# | 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... |