3rd Balkan Olympiad in Informatics
Varna, Bulgaria, 5-11 October 1995


Day 2 - Problem 3 (Baseball League)



A connected transmission is constructed by n (n<=30) cylindrical units, labeled by 1,2,...,n in such a way that some pairs of units come to contact. If the units i and j contact and one of them is made going round in one of the two possible directions (Clockwise or Opposite), then the other begins to go round in the opposite direction. If a unit going round in one direction then the transmission blocks up.
You have to write a program which for a given transmission determines its behavior when a given unit i is made to go round in a given direction: blocks up or works normally. If the transmission works normally the program prints a list of units going round with the corresponding directions. Else the program has to determine the minimum number of units different from i to be removed from the blocked transmission so that all remaining units are going round when the unit i is made to go round.