# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
919214 | ibrahim001 | Monkey and Apple-trees (IZhO12_apple) | C++17 | 421 ms | 193104 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"
#define intt long long
using namespace std;
const intt inf = 1e18;
const int sz = 1e5+5;
int st[sz*60], lz[sz*60], L[sz*60], R[sz*60];
int last=1;
void check(int in){
if ( !L[in] ) L[in] = ++last;
if ( !R[in] ) R[in] = ++last;
}
void relax(int l, int r, int in){
if ( !lz[in] ) return;
st[in] = (r-l+1);
if ( l == r ){
lz[in]=0;
return;
}
check(in);
lz[L[in]] += lz[in];
lz[R[in]] += lz[in];
lz[in]=0;
}
void update(int a, int b, int l, int r, int in){
relax(l, r, in);
if ( l > b or r < a ) return;
if ( a <= l and r <= b ){
lz[in]++;
relax(l, r, in);
return;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |