#1236
Unrated
ENDOR
시간 제한
1s
메모리 제한
64MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

1 second, 64 MB, 160 points On the forest-filled moon of Endor there is, if we are to believe the Guinness Book of Records, the longest stick in the whole galaxy. On that stick of L meters in length there are N cheerful chameleons. Each chameleon is moving along the stick with constant speed of 1 m/s in one of two possible directions (left or right) and is colored in one of the possible K colors. It is known that the chameleons of Endor worship the ancient ant laws that dictate that the walk along the stick must be continued until the end of the stick is reached (which means getting offit), and when a collision with another chameleon takes place, you must turn 180 degrees and continue the walk in the opposite direction. Additionally, after a chameleon colored in a moving to the left collides with a chameleon colored in b moving to the right, the chameleon moving to the left before the collision takes the color of the chameleon moving to the right before the collision (so, color b), while the chameleon moving to the right before the collision takes a new color (a + b) mod K. If you are given the initial positions, colors and directions of movement of all the chameleons, for each color determine the total trip taken by the chameleons in that color before getting offthe stick.

입력

The first line of input contains the integers N, K and L (1 ⩽N ⩽100 000, 1 ⩽K ⩽40, 1 ⩽L ⩽ 1 000 000) from the task. The ith of the following N lines contains the integer di (0 ⩽di ⩽L) that denotes the distance between the ith chameleon and the left end of the stick, then the integer bi (0 ⩽bi ⩽K −1) that denotes the color of the ith chameleon and the character ‘L’ (left) or ‘D’ (right) that denote the direction of movement of the ith chameleon. All integers di will be unique and given in strictly ascending order.

출력

The output must contain K lines, the ith line containing the total trip taken by the chameleons in color i.

예제 입력 1

2 3 10
0 0 D
10 1 L

예제 출력 1

10.0
10.0
0.0

예제 입력 2

4 3 7
1 0 D
3 0 D
4 1 L
6 2 D

예제 출력 2

10.0
4.0
1.0

예제 입력 3

4 4 5
1 1 D
3 3 L
4 2 D
5 0 L

예제 출력 3

2.5
4.0
2.5
4.0
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.