-->
当前位置:首页 > 题库

PROGRAMMING:press forward to the enemy's capital

Luz5年前 (2021-05-10)题库829
This topic is a war blockbuster - you need to start from your own base camp and fight all the way to the enemy base camp. First of all, time is life, so you must choose the right path to occupy the enemy base camp as quickly as possible. When such a path is not unique, it is required to choose the path that can liberate the most towns along the way. If such a path is not unique, choose the path that can effectively kill the most enemy.
###Input format:
Enter the first line to give two positive integers' n '(2 $$$Le $$'n' $$Le $$200, total number of towns) and 'k' (number of roads between towns), as well as the codes of your own base camp and enemy base camp. Next, line 'n' - 1, each line gives the code number of a town and the number of enemy troops stationed in addition to its own base camp, separated by a space. Then there are k lines, each line gives the length of the road between two towns according to the format of town 1 town 2 distance. Let's assume that the code of each town (including the base camp of both sides) is a string composed of three capital English letters.
###Output format:
Find the most suitable attack path according to the requirements of the title (the title ensures that the fastest, most liberated and most lethal path is the only one), and output in the first line according to the format "own base camp - > Town 1 - >... - > enemy base camp". The second line outputs the number of the fastest attack path, the shortest attack distance, and the total number of enemy annihilation in sequence, separated by a space, and there must be no extra space at the beginning and end of the line.
###Input example:
```in
10 12 PAT DBY
DBY 100
PTA 20
PDS 90
PMS 40
TAP 50
ATP 200
LNN 80
LAO 30
LON 70
PAT PTA 10
PAT PMS 10
PAT ATP 20
PAT LNN 10
LNN LAO 10
LAO LON 10
LON DBY 10
PMS TAP 10
TAP DBY 10
DBY PDS 10
PDS PTA 10
DBY ATP 10
```
###Output example:
```out
PAT->PTA->PDS->DBY
3 30 210
```






answer:If there is no answer, please comment