TopCoder

icube
baluteshih 好強 <(_ _)>

User's AC Ratio

66.7% (6/9)

Submission's AC Ratio

20.0% (7/35)

Tags

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

Hints

Problem Source

TIOJ第一屆愚人節比賽:pG

Subtasks

No. Testdata Range Score
1 0 24
2 0~1 76

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 800 262144 262144 1 2
1 800 262144 262144 2