PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#FW0000022. Du lịch không dừng (Non-Stop Travel)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Du lịch không dừng (Non-Stop Travel)
Non-Stop Travel
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Directed intersections have travel delays. Find a minimum-delay route from to and output its sequence of vertices. A route is guaranteed to exist.
Input
; for each , read then pairs ; finally .
Output
Print Path = followed by the vertex sequence, then ; D second delay.
Subtasks
- Subtask 1 (40 points): ; ; ; ; .
- Subtask 2 (60 points): ; ; ; .
Examples
Input
3
2 2 2 3 10
1 3 3
0
1 3
Output
Path = 1 2 3; 5 second delay
Explanation
The route has delay , less than the direct route of delay .