Time Limit: Java: 2000 ms / Others: 2000 ms
Memory Limit: Java: 65536 KB / Others: 65536 KB
When a radio station is broadcasting over a very large area, repeaters are
used to retransmit the signal so that every receiver has a strong signal. However,
the channels used by each repeater must be carefully chosen so that nearby repeaters
do not interfere with one another. This condition is satisfied if adjacent repeaters
use different channels.
Since the radio frequency spectrum is a precious resource, the number of channels required by a given network of repeaters should be minimised. You have to write a program that reads in a description of a repeater network and determines the minimum number of channels required.