def _clear(self, node, left, right):
        """propagates the lazy updates for this node to the subtrees.
        as a result the maxval, minval, sumval values for the node
        are up to date.
        """
        if self.lazyset[node] is not None:  # first do the pending set
            val = self.lazyset[node]
            self.minval[node] = val
            self.maxval[node] = val
            self.sumval[node] = val * (right - left)
            self.lazyset[node] = None
            if left < right - 1:            # not a leaf
                self.lazyset[2 * node] = val    # propagate to direct descendents
                self.lazyadd[2 * node] = 0
                self.lazyset[2 * node + 1] = val
                self.lazyadd[2 * node + 1] = 0
        if self.lazyadd[node] != 0:        # then do the pending add
            val = self.lazyadd[node]
            self.minval[node] += val
            self.maxval[node] += val
            self.sumval[node] += val * (right - left)
            self.lazyadd[node] = 0
            if left < right - 1:            # not at a leaf
                self.lazyadd[2 * node] += val     # propagate to direct descendents
                self.lazyadd[2 * node + 1] += val
def _clear ( self , node , left , right ) : if self . lazyset [ node ] is not None : val = self . lazyset [ node ] self . minval [ node ] = val self . maxval [ node ] = val self . sumval [ node ] = val * ( right - left ) self . lazyset [ node ] = None if left < right - 1 : self . lazyset [ 2 * node ] = val self . lazyadd [ 2 * node ] = 0 self . lazyset [ 2 * node + 1 ] = val self . lazyadd [ 2 * node + 1 ] = 0 if self . lazyadd [ node ] != 0 : val = self . lazyadd [ node ] self . minval [ node ] += val self . maxval [ node ] += val self . sumval [ node ] += val * ( right - left ) self . lazyadd [ node ] = 0 if left < right - 1 : self . lazyadd [ 2 * node ] += val self . lazyadd [ 2 * node + 1 ] += val
propagates the lazy updates for this node to the subtrees.
        as a result the maxval, minval, sumval values for the node
        are up to date.