10295: CF EDU - Segment Tree P2 - Step 4 - C. Painter
Description
The Italian abstract artist F. Mandarino became interested in drawing one-dimensional black and white paintings. He is trying to find the best location and the number of black sections of the picture. To do this, he spends on the line white and black segments, and after each of these operations, he wants to know the number of black segments in the resulting picture and their total length.
Initially, the line is white. Your task is to write a program that after each of these operations outputs data in which the artist is interested.
Input
The first line of the input file contains the total number of drawn segments $(1≤n≤100,000)$.
The next $n$ lines contain the desc
Output
Sample 1 Input
7
W 2 3
B 2 2
B 4 2
B 3 2
B 7 2
W 3 1
W 0 10
Sample 1 Output
0 0
1 2
1 4
1 4
2 6
3 5
0 0