hiho week 19 register

Ended

Participants:317

Verdict:Accepted
Score:100 / 100
Submitted:2014-11-11 22:52:32

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<bits/stdc++.h>
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const int maxn=1000010;
int n,m;
int a[maxn<<2];
int pushup(int rt){
    a[rt]=min(a[rt<<1],a[rt<<1|1]);
}
void build(int l,int r,int rt){
    if (l==r){
        scanf("%d",&a[rt]);
        return;
    }
    int m=(l+r)>>1;
    build(lson);
    build(rson);
    pushup(rt);
}
void update(int p,int d,int l,int r,int rt){
    if (l==r){ a[rt]=d; return;}
    int m=(l+r)>>1;
    if (p<=m) update(p,d,lson);
    else update(p,d,rson);
    pushup(rt);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX