#include<stido.h>
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
#define INF 0x7fffffff
#define size 100
int arr[size];
struct SegTreeNode
{
int max;
int min;
int sum;
int addMark;
}segTree[4*size];
void build(int root,int istart,int iend,int arr[])
{
segTree[root].addMark=0;
if(istart==iend)
segTree[root].min=arr[istart];
else{
int mid=(istart+iend)/2;
build(2*root+1,istart,mid,arr);
build(2*root+2,mid+1,iend,arr);
segTree[root].min(segTree[2*root+1].min,segTree[2*root+2].min)
}
}
void pushDown(int root)
{
if(segTree[root].addMark!=0){
segTree[2*root+1].addMark+=segTree[root].addMark;
segTree[2*root+2].addMark+=segTree[root].addMark;
segTree[root].addMark=0;
}
}
int query(int root,int nstart,int nend,int qstart,int qend)
{
if(nend<qstart||nstart>qend)
return INF;
if(nstart>=qstart&&nend<=qend)
return segTree[root].min;
pushDown(root);
int mid=(nstart+nend)/2;
return min(query(2*root+1,nstart,mid,qstart,qend),query(2*root+2,mid+1,nend,qstart,qend));
}
void updateOne(int root,int nstart,int nend,int index,int addVal)
{
if(nstart==nend){
if(index==nstart)
segTree[root].min+=addVal;
return;
}
int mid=(nstart+nend)/2;
if(int index<=mid)
updateOne(2*root+1,nstart,mid,index,addVal);
else updateOne(2*root+2,mid+1,nend,index,addVal);
segTree[root].min=min(segTree[2*root+1].min,segTree[2*root+2].min);
}
void update(int root,int nstart,int nend,int ustart,int uend,int addVal)
{
if(ustart>nend||uend<nstart)
return;
if(ustart<=nstart&&uend>=nend){
segTree[root].addMark+=addVal;
segTree[root].min+=addVal;
return;
}
pushDown(root);
int mid=(nstart+nend)/2;
update(2*root+1,nstart,mid,ustart,uend,addVal);
update(2*root+2,mid+1,nend,ustart,uend,addVal);
segTree[root].min=min(segTree[2*root+1].min,segTree[2*root+2].min);
}
int main()
{
return 0;
}
void build(int root,int istart,int iend,int arr[])
{
}
void pushDown(int root)
{
}
int query(int root,int nstart,int nend,int qstart,int qend);
{
}
void update(int root,int nstart,int nend,int ustart,int uend,int addVal)
{
}