# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1138114 | Hamed_Ghaffari | Monkey and Apple-trees (IZhO12_apple) | C++20 | 380 ms | 193868 KiB |
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define mid (l+r>>1)
const int MX=1<<30;
struct seg {
int ans;
bool lz;
seg *lc, *rc;
seg(): ans(0), lz(0), lc(NULL), rc(NULL) {}
};
seg *root = new seg();
void pull(seg *v) {
v->ans = 0;
if(v->lc) v->ans += v->lc->ans;
if(v->rc) v->ans += v->rc->ans;
}
void apply(int l, int r, seg *v) {
v->ans = r-l; v->lz = 1;
}
void push(int l, int r, seg *v) {
if(r-l==1 || !v->lz) return;
if(!v->lc) v->lc = new seg();
if(!v->rc) v->rc = new seg();
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |