# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1175919 | matus192 | Monkey and Apple-trees (IZhO12_apple) | C++20 | 476 ms | 137344 KiB |
#include <bits/stdc++.h>
using namespace std;
class SparseSegtree {
private:
struct Node {
int freq = 0;
int lazy = 0;
Node *left = nullptr;
Node *right = nullptr;
};
Node *root = new Node;
const int n;
int comb(int a, int b) { return a + b; }
void apply(Node *cur, int len, int val) {
if (val == 1) {
(cur->lazy) = val;
(cur->freq) = len * val;
}
}
void push_down(Node *cur, int l, int r) {
if ((cur->left) == nullptr) { (cur->left) = new Node; }
if ((cur->right) == nullptr) { (cur->right) = new Node; }
int m = (l + r) / 2;
apply(cur->left, m - l + 1, cur->lazy);
apply(cur->right, r - m, cur->lazy);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |