Editorial for COCI '10 Contest 7 #2 Kolo


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.

We will store the wheel as an array of characters initially filled with question marks. We need to simulate every spin that Mirko makes and write the obtained letter into the corresponding field. If that field is already filled with a letter different than the one we are trying to write, we output ! and exit.

To simulate turning the wheel in one direction, we will pretend to move the arrow around the wheel in the opposite direction. If at some point we reach the end of the array, we start from the beginning.

When we are done, we must check whether some letter appears twice in the array. If this is the case, we output !. Otherwise, we output the array in the requested order.


Comments

There are no comments at the moment.