시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 26 | 8 | 6 | 60.000% |
Sarah is cycling to work. On her way there, she encounters the same traffic light every day. Before she reaches the lights, she alternates between using social media on her mobile device and glancing at the traffic lights, observing if they are green, yellow or red at that time. From experience, she knows that the lights have a fixed greenyellow-red cycle, and how long each stage lasts. So if the light goes from red to green at time T, she knows it will stay green until (but not including) T +Tg, then go yellow until (but not including) T + Tg + Ty and finally stay red until (but not including) T + Tg + Ty + Tr, at which point it will turn green again. However, she does not know T, the time at which the traffic light cycle starts. Based on her observations, she can deduce what values of T are (im)possible. Assuming that each possible value of T that is consistent with her observations is equally likely, can you compute the probability that the lights will be green at a certain time?
4 4 4 3 2 green 18 yellow 34 red 5 green
0.25
4 4 4 4 2 green 6 yellow 10 red 14 green 4 red
0
6 6 6 6 5 green 6 green 9 yellow 12 yellow 15 red 19 red 7 green
1
ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2018 Preliminaries G번