E. A-4 Stop Blowing, Wind of Longing

    传统题 600ms 256MiB

A-4 Stop Blowing, Wind of Longing

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

1.jpg

A popular slogan often seen at tourist spots goes: "The wind that misses you has blown to XXX." However, rebellious travelers deliberately avoid the places where this wind supposedly blows.

Given a tourist map, please design an optimal route for rebellious travelers to get from their starting point to their destination, avoiding all locations marked with such "trendy slogans."

The "optimal route" should prioritize being the most cost-effective, meaning the total travel cost from the starting point to the destination should be minimized. If multiple routes have the same cost, the traveler prefers the one that passes through the maximum number of locations, while still avoiding all slogan-marked spots. If it is impossible to avoid these trendy locations, the traveler has no choice but to accept reality and choose the most cost-effective route that reaches the destination, while aiming to pass through the minimum number of slogan-marked locations among the equally cost-effective options.

输入格式

The first line contains two positive integers NN and MM ( 2N1032 \le N \le 10^3 ), representing the number of tourist locations and the number of transportation paths between them, respectively.
The next MM lines each contain three positive integers AiA_i , BiB_i , and CiC_i ( $1 \le A_i, B_i \le N, 0 \le C_i \le 10^6, A_i \neq B_i$ ), indicating a bidirectional transportation path between locations AiA_i and BiB_i with a cost of CiC_i . There are no duplicate paths between any two locations.
The following line contains a single integer KK ( 0KN0 \le K \le N ), denoting the number of locations marked with trendy slogans.
The subsequent line lists KK integers separated by spaces, each representing the ID of a slogan-marked location.
The last line contains two integers SS and TT ( 1S,TN,ST1 \le S, T \le N, S \neq T ), indicating that the journey starts at location SS and ends at location TT . It is guaranteed that there exists at least one route from the starting point to the destination.
All location IDs are numbered starting from 1.

输出格式

Output two integers separated by a space. The first integer represents the total cost of the most cost-effective route. If the chosen route avoids all slogan-marked locations, the second integer should indicate the total number of locations passed through. Otherwise, the second integer should represent the minimum number of slogan-marked locations passed through in the route.

题目示例数据

7 10
1 2 5
1 3 3
2 4 1
3 4 2
3 5 50
3 7 20
4 6 1
4 5 0
5 7 30
5 6 10
1
4
1 6
63 5
7 10
1 2 4
1 3 3
2 4 1
3 4 2
3 5 50
3 7 20
4 6 1
4 5 0
5 7 30
5 6 10
2
4 3
1 6
6 1

基础算法测试赛

未参加
状态
已结束
规则
IOI
题目
5
开始于
2025-8-1 9:00
结束于
2025-8-1 12:00
持续时间
3 小时
主持人
参赛人数
1