# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
116621 | nandonathaniel | Monkey and Apple-trees (IZhO12_apple) | C++14 | 110 ms | 3192 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;
typedef long long LL;
struct Node{
LL L,R,value;
bool lazy;
Node *left,*right;
void reset(){
value=0;
lazy=0;
left=NULL;
right=NULL;
}
LL query(LL x,LL y){
if(L>=x && R<=y)return value;
if(L>y || R<x)return 0;
if(lazy)return min(R,y)-max(L,x)+1;
LL ans=0;
if(left!=NULL)ans+=left->query(x,y);
if(right!=NULL)ans+=right->query(x,y);
return ans;
}
void update(LL x,LL y){
if(L>=x && R<=y){
lazy=1;
value=R-L+1;
return;
}
if(L>y || R<x)return;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |