TopCoder

Thumb hsnu2016
Adrien Wu
$ \begin{align} AC \times 2^9 \\ \text{New TIOJ ?} \end{align} $

User's AC Ratio

40.0% (2/5)

Submission's AC Ratio

10.0% (2/20)

Description

Andrew prefers taxi to other means of transport, but recently most taxi drivers have been acting inappropriately. In order to earn more money, taxi drivers started to drive in circles. Roads in Andrew's city are one-way, and people are not necessary able to travel from one part to another, but it pales in comparison to insidious taxi drivers.
The mayor of the city decided to change the direction of certain roads so that the taxi drivers wouldn't be able to increase the cost of the trip endlessly. More formally, if the taxi driver is on a certain crossroads, they wouldn't be able to reach it again if he performs a nonzero trip.
Traffic controllers are needed in order to change the direction the road goes. For every road it is known how many traffic controllers are needed to change the direction of the road to the opposite one. It is allowed to change the directions of roads one by one, meaning that each traffic controller can participate in reversing two or more roads.
You need to calculate the minimum number of traffic controllers that you need to hire to perform the task and the list of the roads that need to be reversed.
以上是一個Codeforces上的題目敘述。
你,身為一個只喜歡看題目的人,覺得一直解題實在太煩了,想要做一點不同的事。因此,你決定寫一個用UTF-8輸出這題題目敘述的程式。

Input Format

Output Format

Sample Input

Sample Output

Hints

Problem Source

TIOJ第一屆愚人節比賽:pG

Subtasks

For Testdata: 0 ~ 0, Score: 24
For Testdata: 0 ~ 1, Score: 76
No. Time Limit (ms) Memory Limit (KiB) Output Limit (KiB)
0 800 262144 262144
1 800 262144 262144