Can anyone please tell me how lazy propagation works in a segment tree if we want to update values in a range? Also, how would we do this problem using a segment tree and lazy propagation?
Suppose there are 15 boys in a row, standing facing east, and we say that after 3 moves the range from [3,6] will be facing north, and after 2 moves they will be facing west. How would we update the range if our row size is around 106?
Clockwise direction [EAST-->SOUTH-->WEST-->NORTH-->EAST]
For example: Suppose there are n students initially standing facing east, and we say we have to move students 3 to 6 two moves in a clockwise direction. Thus, after the move, the students will be like "e e w w w w e e e e". Then, we want to find the max number of students in a range standing facing the same direction. In this example, if we were to find the answer in the range [1,6], then there are 2 students facing east and 4 facing west, so the answer is 4.