hiho week 22 register

Ended

Participants:196

Verdict:Accepted
Score:100 / 100
Submitted:2014-12-01 20:57:31

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string.h>
using namespace std;
struct node{
    node *leftChild, *rightChild;
    int l, r;
    int set;
    int add;
    int sum;
};
node *leaf[100005], *root;
node* buildTree(int l, int r){
    node *n = new node;
    n->l = l;
    n->r = r;
    n->set = -1;
    n->add = 0;
    if(l == r){
        leaf[l] = n;
    }else{
        n->leftChild = buildTree(l, (l+r)/2);
        n->rightChild = buildTree((l+r)/2 + 1, r);
    }
    return n;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX