## Editorial for Back To School '19: A Circular Game

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

Author: Zeyu

For the first subtask, we can try every possible spinner position and calculate the minimum time required to set all spinners to this position. For any spinner, the shortest time will either be going clockwise or counter-clockwise depending on which direction takes less time.

Time Complexity:

For the second subtask, one can observe that checking the current spinner positions is enough to find the minimum time required. This is because we can classify the spinners into two groups: spinners that are faster going clockwise and spinners that are faster going counter-clockwise. For every change in the target position the total time changes in relation with the two groups, and thus the current spinner positions will lead to the optimal time.

Time Complexity: