SCUT - 153 - Ma Ying-jeou and his mountain - segment tree

https://scut.online/p/153

In fact, you do not need tree line, only care about the difference between adjacent elements, like the gods, as with differential can O1 maintenance.

But I have chosen to use.

Written before that pay attention not only st segment tree itself labeled lazy, you must query each time to get a real array, anyway, there is a little bit of both constant query forget altogether.

A small beginning to consider a special case, l == r time, this time if l itself is repeated on the mountain.

The second time I actually use the new a [l] and old a [l + 1] to compare?

Third on all to compare with the new value, and can be.

In fact, the second bug fixes that can be adopted.

Guess you like

Origin www.cnblogs.com/Yinku/p/11306558.html