#P8802. [蓝桥杯 2022 国 B] 出差
[蓝桥杯 2022 国 B] 出差
Problem Description
Country A has cities, numbered . Xiaoming is an employee of a company located in city . Today, he suddenly received a notice from his supervisor that he needs to go on a business trip to city .
Due to the pandemic, many direct transportation options are temporarily shut down. Xiaoming cannot take a plane directly from city to city , and must transfer by land transportation through other cities. Through a transportation information network, he found routes between cities that are still open, along with the time required for each route.
Also due to the pandemic, after arriving at a city, Xiaoming must stay in quarantine for a period of time before he can leave that city to travel to other cities. He also found the quarantine information for each city online. (Since Xiaoming was previously in city , he can leave city directly and does not need to quarantine.)
Because his supervisor requires it, Xiaoming wants to reach city as quickly as possible. So he asks you for help, hoping you can plan a route that allows him to arrive at city in the shortest time.
Input Format
Line : Two positive integers , where is the number of cities in Country A, and is the number of routes that have not been closed.
Line : positive integers. The -th integer means the quarantine time required after arriving at city .
Lines : Each line contains three positive integers , meaning there is a bidirectional route between city and city that is still open, and the travel time on this route is .
Output Format
Line : One positive integer, the shortest time for Xiaoming to start from city and arrive at city . (After arriving at city , the quarantine time of city does not need to be counted.)
4 4
5 7 3 4
1 2 4
1 3 5
2 4 3
3 4 5
13
Hint
[Sample Explanation]

[Testdata Scale and Rules]
For of the testdata, $1 \leq N \leq 1000, 1 \leq M \leq 10000, 1 \leq C_i \leq 200, 1 \leq u, v \leq N, 1 \leq c \leq 1000$.
Lanqiao Cup 2022 National Contest B Group, Problem E.
Translated by ChatGPT 5