atcoder#ABC281C. [ABC281C] Circular Playlist
[ABC281C] Circular Playlist
Score : points
Problem Statement
We have a playlist with songs numbered . Song lasts seconds.
When the playlist is played, song , song , , and song play in this order. When song ends, the playlist repeats itself, starting from song again. While a song is playing, the next song does not play; when a song ends, the next song starts immediately.
At exactly seconds after the playlist starts playing, which song is playing? Also, how many seconds have passed since the start of that song? There is no input where the playlist changes songs at exactly seconds after it starts playing.
Constraints
- The playlist does not change songs at exactly seconds after it starts playing.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print an integer representing the song that is playing at exactly seconds after the playlist starts playing, and an integer representing the number of seconds that have passed since the start of that song, separated by a space.
3 600
180 240 120
1 60
When the playlist is played, the following happens. (Assume that it starts playing at time .)
- From time to time , song plays.
- From time to time , song plays.
- From time to time , song plays.
- From time to time , song plays.
- From time to time , song plays.
At time , song is playing, and seconds have passed since the start of that song.
3 281
94 94 94
3 93
10 5678912340
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
6 678912340