Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>#define lowbit(x) (x)&(-x)#define MID (l+r)>>1;#define ls o<<1#define rs (o<<1)|1#define maxn 1000005using namespace std;struct node{int l,r,weight;}tree[maxn<<2];void build(int l,int r,int o=1){tree[o].l=l,tree[o].r=r;if(l==r){scanf("%d",&tree[o].weight);return;}int mid = MID;build(l,mid,ls);build(mid+1,r,rs);tree[o].weight = min(tree[ls].weight,tree[rs].weight);}void update(int x,int alt,int o=1){