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

20372번 - Late Party 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB93375.000%

문제

After the banquet tonight, you will leave the banquet venue together with the F new friends you have made and walk back to your hotel. You want to keep chatting with them as long as possible, though you may unfortunately not all be in the same hotel.

Everybody, you included, is taking one of the shortest paths back to their hotel.

Paris is made of N intersections numbered from 0 to N − 1 and S streets linking two intersections. Streets can of course be walked in both directions. All hotels are located at intersections and are reachable from the banquet. The banquet takes place at intersection number 0.

입력

The input comprises several lines, each consisting of integers separated with single spaces:

  • The first line consists of the three integers N, S, and F.
  • Each of the following S lines consists of three integers i, j, t, representing a street between intersections i and j, taking t minutes to walk through.
  • The last line consists of F + 1 integers representing the intersections of the hotels where people stay; the first one is yours, the other ones are your friends’ respective hotels.

출력

The output should consist of a single line, whose content is an integer, the longest time (in minutes) you can stay accompanied by at least one friend.

제한

  • 1 ≤ N ≤ 100 000
  • 0 ≤ S ≤ 300 000
  • 0 ≤ F ≤ 10 000
  • 1 ≤ t ≤ 1 000 000

예제 입력 1

7 12 1
0 1 1
0 2 2
0 2 4
1 3 2
2 3 1
1 4 2
4 2 2
1 5 3
2 5 1
5 6 2
4 6 2
3 6 3
3 6

예제 출력 1

2

힌트

출처

ICPC > Regionals > Europe > Southwestern European Regional Contest > SWERC 2018 연습 세션 PA번

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

출처

대학교 대회

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

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