Einbahnstra
WIDTH="15" HEIGHT="34" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/702-1.png"
ALT="$ \beta$">
You just started a new job at a car-towing company. The company has a number of towing trucks parked at the company's garage. A tow-truck lifts the front or back wheels of a broken car in order to pull it straight back to the company's garage. You receive calls from various parts of the city about broken cars that need to be towed. The cars have to be towed in the same order as you receive the calls. Your job is to advise the tow-truck drivers regarding the shortest way in order to collect all broken cars back in to the company's garage. At the end of the day, you have to report to the management the total distance traveled by the trucks.
Your program will be tested on one or more test cases. The first line of each test case specifies three numbers (N
$0 < N < 100$
-->
0 < N < 100
$0 \le C < 1000$
-->
0
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/702-2.png"
ALT="$ \le$">C < 1000
A
A
A
A
The test case in the example below is the same as the one in the figure.
For each test case, print the total distance traveled using the following format:
k
.
V
Where k
is a space, and V
4 2 5
NewTroy Midvale Metrodale
NewTroy <-20-> Midvale
Midvale --50-> Bakerline
NewTroy <-5-- Bakerline
Metrodale <-30-> NewTroy
Metrodale --5-> Bakerline
0 0 0
1. 80
Migrated from old NTUJ.
Arab & North Africa 2008
No. | Testdata Range | Score |
---|