Code Library Of Others/sgtlaugh/HLD + RMQ On Edges.cpp
inline void push(int idx, int a, int b){
        int c = (a + b) >> 1, d = c + 1, p = idx << 1, q = p | 1;
        if (lazy[idx]){
            tree[idx] += (lazy[idx] * (b - a + 1)); /// Change lazy according to operation
            if (a != b) lazy[p] += lazy[idx], lazy[q] += lazy[idx]; /// Change lazy according to operation
            lazy[idx] = 0;
        }
    }
/// Change lazy propagation accordingly
/// Note lazy and updates set for adding values in node, update if set/replace operation
Change lazy propagation accordingly
Note lazy and updates set for adding values in node, update if set/replace operation
Change lazy propagation accordingly Note lazy and updates set for adding values in node update if set / replace operation
inline void push(int idx, int a, int b){
        int c = (a + b) >> 1, d = c + 1, p = idx << 1, q = p | 1;
        if (lazy[idx]){
            tree[idx] += (lazy[idx] * (b - a + 1)); 
            if (a != b) lazy[p] += lazy[idx], lazy[q] += lazy[idx]; 
            lazy[idx] = 0;
        }
    }
inline void push ( int idx , int a , int b ) { int c = ( a + b ) >> 1 , d = c + 1 , p = idx << 1 , q = p | 1 ; if ( lazy [ idx ] ) { tree [ idx ] += ( lazy [ idx ] * ( b - a + 1 ) ) ; if ( a != b ) lazy [ p ] += lazy [ idx ] , lazy [ q ] += lazy [ idx ] ; lazy [ idx ] = 0 ; } }
Change lazy propagation accordingly
Note lazy and updates set for adding values in node, update if set/replace operation
Change lazy propagation accordingly Note lazy and updates set for adding values in node update if set / replace operation
/// Change lazy according to operation /// Change lazy according to operation