# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1143105 | SulA | Monkey and Apple-trees (IZhO12_apple) | C++20 | 444 ms | 327680 KiB |
#include <bits/stdc++.h>
//#pragma GCC optimize("popcnt")
#define all(a) a.begin(), a.end()
using namespace std;
using namespace chrono;
struct node {
int l, r, sum = 0, lazy = 0;
node *lc = nullptr, *rc = nullptr;
node(int l, int r) : l(l), r(r) {}
void create_kids() {
if (l == r || lc != nullptr) return;
int mid = (l+r)/2;
lc = new node(l, mid);
rc = new node(mid+1, r);
}
void propagate() {
create_kids();
if (lazy != 0) {
sum = (r-l+1)*lazy;
if (l != r)
lc->lazy = lazy, rc->lazy = lazy;
lazy = 0;
}
}
void update(int ul, int ur, int x) {
propagate();
if (ul <= l && r <= ur) {
lazy = x;
propagate();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |