RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00377

Endor

Unrated 레이팅 미적용
난이도
1s
시간 제한
64MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(4^{th}\) round, December \(19^{th}\) 2015
On the fore\(st-fi\)lled 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.

제약

In test cases worth 50% of total points, it will additionally hold (1 ⩽\(N\) ⩽3 000).

입력 형식

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 \(i\)^{th} of the following \(N\) lines contains the integer \(d@@RISE_MATH_BLOCK_0@@i\)\(L\)) that
denotes the distance between the \(i\)^{th} chameleon and the left end of the stick, then the integer \(b_{i}\)
(0 ⩽\(b_{i}\)\(K - 1\)) that denotes the color of the \(i\)^{th} chameleon and the character ‘L’ (left) or ‘D’ (right)
that denote the direction of movement of the \(i\)^{th} chameleon. All integers \(d\)\(i\) will be unique and given
in strictly ascending order.

출력 형식

The output must contain \(K\) lines, the \(i\)^{th} line containing the total trip taken by the chameleons in
color \(i\).

예제 1
입력
2 3 10
0 0 D
10 1 L
4 3 7
1 0 D
3 0 D
4 1 L
6 2 D
4 4 5
1 1 D
3 3 L
4 2 D
5 0 L
출력
output
output
10.0
10.0
0.0
10.0
4.0
1.0
2.5
4.0
2.5
4.0
설명

Clarification of the first example: The chameleons collide after 5 travelled meters in the middle of the
stick. After that, both chameleons change their direction of movement. The chameleon moving to the right
after collision is colored in 0, whereas the chameleon moving to the left after collision is colored in 1.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2015/2016 Contest 4

평가 및 의견

Endor

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Endor

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8