Logo
(追記) (追記ここまで)

6909번 - Trucking Troubles 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB39262165.625%

문제

You are a salesperson selling trucks which can carry trucks which can carry trucks. Needless to say, your trucks are heavy. Also needless to say, you have to drive one of these trucks across a wide wet domain, and since it is wet, you need to drive over some bridges. In fact, on every road between two cities, there is a bridge but there is not a direct road between every pair of cities. Each bridge can support a certain maximum weight. This maximum weight is an integer from 0ドル$ to 100ドル,000円$.

You have been given a list of cities where there are customers who are eager to view one of your trucks. These cities are called destination cities. Since you must decide which truck you will drive through these cities, you will have to answer the following problem: what is the maximum weight that can be driven through these destination cities? You are to write a program to solve this problem.

The first line of input will contain three positive integers: $c,ドル $r$ and $d$ specifying the number of cities (in total), number of roads between cities and number of destination cities, respectively. The cities are numbered from 1ドル$ to $c$. There are at most 10ドル,000円$ cities and at most 100ドル,000円$ roads. The next $r$ lines contain triples $x\ y\ w$ indicating that this road runs between city $x$ and city $y$ and it has a maximum weight capacity of $w$. The next $d$ lines give the destination cities you must visit with your truck. There will be at least one destination city.

You can assume that you are starting in city 1ドル$ and that city 1ドル$ is not a destination city. You can visit the $d$ destination cities in any order, but you must visit all $d$ destination cities.

The output from your program is a single integer, the largest weight that can be driven through all $d$ destination cities.

입력

출력

제한

예제 입력 1

5 7 3
1 2 20
1 3 50
1 4 70
1 5 90
2 3 30
3 4 40
4 5 60
2
4
5

예제 출력 1

30

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2003 > CCC 2003 Senior Division 5번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /