#P9724. [EC Final 2022] Chase Game

[EC Final 2022] Chase Game

题目描述

Prof. Shou is being chased by Prof. Pang on an undirected unweighted simple graph. Initially, Prof. Shou is at vertex 11. His destination is vertex nn. Prof. Pang is at vertex kk.

In each second, Prof. Shou may choose an adjacent vertex and walk to that vertex. Then Prof. Shou is attacked by Prof. Pang. The damage of this attack is equal to ddisd-dis where dd is Prof. Pang's attack range and disdis is the distance (number of edges in the shortest path) between Prof. Shou and Prof. Pang on the graph. However, when disdis is greater than or equal to dd, Prof. Pang cannot deal any positive damage. In this case, instead of attacking with non-positive damage, he will teleport to the vertex where Prof. Shou is and then deal dd damage. (When disdis is less than dd, Prof. Pang will stay at his current vertex.)

Please find the minimum sum of damage Prof. Shou will take to reach vertex nn from vertex 11. Prof. Shou will take the last attack at vertex nn.

输入格式

The first line contains 44 integers n,m,k,dn, m, k, d ($2\le n\le 10^5, n-1\le m\le 2\times 10^5, 1\le k\le n, 1\le d\le 2\times 10^5$).

Each of the next mm lines contains two integers a,ba, b (1a,bn,ab1\le a, b\le n, a \ne b) representing an edge of the graph. The edges are distinct. (a ba\ b and b ab\ a represents the same edge. Thus, only one of these two lines may appear in the input.)

It is guaranteed that the graph is connected.

输出格式

Output one integer representing the answer in one line.

题目大意

【题目描述】

Shou 教授被 Pang 教授在一个无向无权简单图上追赶。最初,Shou 教授在顶点 11。他的目的地是顶点 nn。Pang 教授在顶点 kk

每秒钟,Shou 教授可以选择一个相邻的顶点并走向该顶点。然后,Shou 教授会受到 Pang 教授的攻击。此次攻击的伤害等于 ddisd-dis,其中 dd 是 Pang 教授的攻击范围,disdis 是图上从 Shou 教授到 Pang 教授的距离(最短路径上的边数)。然而,当 disdis 大于或等于 dd 时,Pang 教授无法造成任何正伤害。在这种情况下,他将不会使用非正的伤害攻击,而是会传送到 Shou 教授所在的顶点,然后造成 dd 伤害。(当 disdis 小于 dd 时,Pang 教授将停留在当前顶点。)

请找出 Shou 教授从顶点 11 到顶点 nn 所需的最小伤害总和。Shou 教授将在顶点 nn 处受到最后一次攻击。

【输入格式】

第一行包含 44 个整数 n,m,k,dn, m, k, d ($2\le n\le 10^5, n-1\le m\le 2\times 10^5, 1\le k\le n, 1\le d\le 2\times 10^5$)。

接下来的 mm 行中,每行包含两个整数 a,ba, b (1a,bn,ab1\le a, b\le n, a \ne b),表示图的一条边。边是不同的。(a ba\ bb ab\ a 表示相同的边。因此,在输入中只会出现这两行中的一行。)

保证图是连通的。

【输出格式】

输出一行整数,表示答案。

翻译来自于:ChatGPT

5 5 3 1
1 2
2 4
4 5
1 3
3 5

2

13 17 12 3
1 2
2 3
3 4
4 13
5 13
7 8
7 9
7 10
7 11
7 6
12 7
1 8
8 9
9 10
10 11
11 6
6 13

7