#P3393. Escape from Zombie Invasion
Escape from Zombie Invasion
Escape from Zombie Invasion
In this problem, a zombie invasion has taken over several cities. You are given a country with \(N\) cities and \(M\) bidirectional roads connecting them. There are \(K\) cities that are under zombie control; these cities cannot be entered. Furthermore, any city that can reach any zombie controlled city within \(S\) roads is considered dangerous because it requires special security measures, making the cost to stay there \(Q\) instead of the usual \(P\) in safe cities.
Little A lives in city 1 and needs to escape from the country by reaching city \(N\) (which is not under zombie control). For each road traveled (each day’s journey) he must spend the night in a hotel located in an intermediate city (except for the starting city and the destination, which do not require a hotel). If he stays in a safe city, the cost is \(P\); if he stays in a dangerous city, the cost is \(Q\).
Your task is to determine the minimum total cost required for Little A to travel from city 1 to city \(N\), avoiding zombie controlled cities and accounting for the increased cost of dangerous cities. It is guaranteed that there is a path from city 1 to city \(N\).
Note: All formulas are given in \(\LaTeX\) format. For example, the country has \(N\) cities and \(M\) roads, and a city is dangerous if its distance to any zombie controlled city is \(\le S\).
inputFormat
The first line contains six integers \(N\), \(M\), \(K\), \(S\), \(P\) and \(Q\) — the number of cities, the number of roads, the number of zombie controlled cities, the maximum distance for a city to be dangerous, the hotel cost in a safe city, and the hotel cost in a dangerous city respectively.
The second line contains \(K\) distinct integers, representing the indices of the zombie controlled cities. Note that city 1 and city \(N\) are never zombie controlled.
Each of the next \(M\) lines contains two integers \(u\) and \(v\), representing a bidirectional road between cities \(u\) and \(v\). It is guaranteed that there are no self-loops or multiple edges.
outputFormat
Output a single integer: the minimum total hotel cost Little A must pay to travel from city 1 to city \(N\).
sample
4 4 1 1 100 200
3
1 2
2 3
2 4
3 4
200