Editorial for COCI '06 Regional #4 Circle


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.

The first step in solving this problem is to simulate the described transformation K times in order to obtain Stanko's final circle.

The reverse transformation is not unique, but there are at most two different circles that, when transformed, yield any given circle – if we fix B or W as one of the pebbles, the rest are determined uniquely.

Therefore there are at most 2^K different possible starting circles. Since K is small enough, we can check all of these and remove any duplicates.


Comments

There are no comments at the moment.