#P2583. [ICPC 2003 WF] 地铁间谍
[ICPC 2003 WF] 地铁间谍
Output Format
For each dataset, print one line (where starts from ) followed by an integer denoting the minimal total waiting time, or the word if Maria cannot accomplish the task.
See the sample output.
4
55
5 10 15
4
0 5 10 20
4
0 5 10 15
4
18
1 2 3
5
0 3 6 10 12
6
0 3 5 7 12 15
2
30
20
1
20
7
1 3 5 7 11 13 17
0
Case Number 1: 5
Case Number 2: 0
Case Number 3: impossible
Hint
Explanation for Sample 1:
She boards at minute , gets off at station , immediately takes the train that left at minute and departs at minute to go back, gets to station , immediately takes the train that started at minute and departs at minute to the terminal, arrives at minute , and then needs to wait minutes.
Translated by ChatGPT 5
京公网安备 11011102002149号