Editorial for COCI '13 Contest 2 #1 Volim
Submitting an official solution before solving the problem yourself is a bannable offence.
The solution to this task is to simulate the described game. For each query, the total game duration should be increased by the duration of that query. If the answer to that query was T
, then the score of the player should be increased by . (The emerging problem is what to do if the box reaches a player with a label greater than , which can be solved easily with remainders.)
We keep repeating this until the total game duration is less or equal to seconds ( minutes and seconds). Notice that the events "incorrect" (N
) and "skipped" (P
) do not make change the player's turn and shouldn't be taken into account. From the task conditions, it is obvious that the query can continue even after the box has exploded. Notice that it is not a problem to end the program before all data has been read, what is important is the correct output. Take a look at the pseudocode for one of the possible solutions to this task.
input (K)
input (N)
game := 0 // game duration, initially zero
while (game <= 210) do
{
input (T, Z)
game := game + T // always increase game duration by T
if (Z = 'T') and (game <= 210) then
K = (K % 8) + 1
}
output(K)
Comments