Vivoparc is a zoological park located in Valencia. It has recently added a new area formedby a big plane savanna grassland divided into several enclosures.Our purpose is to assign one animal of the 4 different species (lions, leopards, tigers, andpanthers) to each of the new VivoParc enclosures. These animals are very territorial thereforewe must be sure that no animal can see other animal of its own species from its enclosure. TheVivoparc manager has sent us a file with the visibility from the different enclosures and we haveto assign one species to each enclosure. At the end of the process, all the enclosures must havean assigned species.INPUTThe first line of the input file contains the number of enclosures (N ≤ 100). Each of the followinglines contain a visibility restriction: 1-3 means that animals in enclosure #1 can see animalsin enclosure #3 and animals in enclosure #3 can see animals in enclosure #1. Note that theVivoparc manager is not a very well organized person and therefore, some data appearing in thefile may be redundant.OUTPUTThe output file contains one of all the possible species assignation. The file consists of aline per enclosure and each line contains the number of the enclosure followed by the assignedspecies (1= Lion, 2= Leopard, 3= Tiger, 4= Panther). Enclosures assignation must appear inascending order.
đang được dịch, vui lòng đợi..