Friends
문제
friends are playing a game. The game is played on a row of squares, numbered from to , where squares and are adjacent to each other. At most one friend stand on each square at any given time. In each step of the game, one friend jumps from its current square to a new (non-occupied) square.
In any moment of the game, the score of a friend is the length of the longest contiguous segment of friends it is part of. This means that if a friend stands on some position , and there are friends on positions , the score of the friend is .
The total score of the game is the sum of scores for all friends. At various times during the game, the friends wonder what their current total score is.
입력
The sample judge reads input in the following format:
- line :
N L Q - line :
P[0] P[1] .. P[N - 1] - lines to : each line represents either a jump or a score question. If the line is
0 A B, a jump from to is to be made, and if the line is1a scoring question is to be made.
출력
For each scoring question, the judge writes a line with the return value of score().
예제
예제 1
3 7 5 1 3 4 1 0 4 2 1 0 3 0 1
5 9 9