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

24240번 - Doomsday 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 (추가 시간 없음) 1024 MB46212044.444%

문제

Doomsday is near! Or at least that’s what your brother is telling you. In his preparations he has constructed a clever network of well concealed food depots and water depots far out in a mountainous region. You are in your base, and the alarm goes off: how quickly can you fetch both food and water supplies?

입력

The first line contains four integers $n,ドル $m,ドル $w,ドル $f,ドル where 1ドル \leq n \leq 50,000円$ is the number of hidden locations, 0ドル \leq m \leq 150,000円$ is the number of trails in the network, 1ドル \leq w \leq n$ is the number of water depots in total, and 1ドル \leq f \leq n$ is the number of food depots in total. Your base is at location 0ドル$. The second line contains $w$ space-separated integers $u_1, u_2, \ldots, u_w,ドル which represents the (distinct) locations of the water depots (0ドル \leq u_i < n$ for each $i$). The third line contains $f$ space-separated integers $v_1, v_2, \ldots, v_f,ドル which represents the (distinct) locations of the food depots (0ドル \leq v_i < n$ for each $i$).

The next $m$ lines each describe a (bidirectional) trail in the network. The $i^{\text{th}}$ such line contains three space-separated integers $a_i,ドル $b_i$ and $t_i$ indicating that there is a trail between location $a_i$ and $b_i$ which takes $t_i$ hours to traverse (0ドル \leq a_i, b_i < n$ and 0ドル \leq t_i < 100$ for each $i$).

출력

Output a single integer, the minimum number of hours required to fetch both food and water and bring it back to base.

제한

예제 입력 1

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

예제 출력 1

14

힌트

출처

Contest > Bergen Open > Bergen Open 2021 D번

  • 문제를 만든 사람: Simen Hornnes
(追記) (追記ここまで)

출처

대학교 대회

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

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