# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31766 | trath | Monkey and Apple-trees (IZhO12_apple) | C++98 | 186 ms | 2176 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;
struct node {
int sum;
struct node *left, *right;
node(){
sum = 0;
left = NULL;
right = NULL;
}
};
void combine(node *root, node *a, node *b){
root->sum= 0;
if(a != NULL) root->sum += a->sum;
if(b != NULL) root->sum += b->sum;
}
void update(node *root, int l, int r, int a, int b){
if(root->sum == r-l+1) return;
if(l == a && r == b){
root->sum=(r-l+1);
return;
}
int m = (l+r) >> 1;
if(b <= m){
if(!root->left) root->left = new node();
update(root->left, l, m, a, b);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |