线段树
# include <bits/stdc++.h> # define inf 0x3f3f3f3f const int maxn = 1e5 + 10 ; using namespace std ; int Sum [ maxn << 2 ] ; //A[maxn<<2];//Sum求和,A为原数组(根据题目更改) int num [ maxn << 2 ] ; int len ; void PushUp ( int node ) //向上更新节点信息 { Sum [ node ] = Sum [ node << 1 ] + Sum [ node << 1 | 1 ] ; } void pushdown ( int node , int wide ) { if ( num [ node ] ) { int t = num [ node ] ; num [ node << 1 ] = t ; num [ node << 1 | 1 ] = t ; Sum [ node << 1 ] = ( wide - ( wide >> 1 ) ) * t ; Sum [ node << 1 | 1 ] = ( wide >> 1 ) * t ; num [ node ] = 0 ; } } void Build ( int l , int r , int node ) { //[l,r