All submissions for this problem are available.
The state of Otahar is an agricultural nation. It consists of F farms connected by R roads. Farms in Otahar are famous for UFO sightings. Every day there are U cases of UFO sightings which are reported. When an UFO lands in a farm it leaves crop circles. After an UFO sighting is reported people flock to that particular farm to see the crop circles.
This sudden interest of people in a farm makes it very difficult for the government of Otahar to manage the traffic. One solution being tried out by the government is allowing only unidirectional traffic on roads in Otahar.
But this creates another problem. Management of essential services like Fire Fighting, Police, Hospitals etc. The Government of Otahar wants to deploy essential services at strategic locations in the nation, so as to have maximum reach.
To find the maximum reach, the policy makers have identified vital farms. A vital farm is one from where people can visit atleast one farm with an UFO sighting reported. Further the policy makers have identified strategic locations as those farms from which roads lead only to vital farms.
As a member of the policy making team of the government of Otahar your job is to find out the strategic locations in Otahar, given description of any day's map of Otahar.
The first line of input will contain three space separated integers, F U R
The next R lines will contain two space separated integers each, x y which denote a road starting from farm #x and ending at farm #y.
Consider the first U farms to have reported UFO sightings today.
A single line containing all strategic locations in Otahar arranged in increasing order.
4 1 4
|Time Limit:||5 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, GO, NODEJS|
Fetching successful submissions
If you are still having problems, see a sample solution here.