#4228. [NOISG 2025 Prelim] Train Or Bus
[NOISG 2025 Prelim] Train Or Bus
[NOISG 2025 Prelim] Train Or Bus
题目描述
You are a tourist who wishes to explore some cities. There are $n + 1$ cities, numbered from $1$ to $n + 1$ in sequence. There are some buses and trains running between these cities.To travel between cities and , you have two transportation options:
- Take a train, which takes units of time.
- Take a bus, which takes units of time.
Determine the minimum total time required to travel from city to city .
输入格式
Your program must read from standard input.The first line of input contains one integer .
The following lines of input each contain one integer. The -th of these lines contains .
The following lines of input each contain one integer. The -th of these lines contains .
输出格式
Your program must print to standard output.Output a single integer, the shortest time taken to travel from city to city .
The output should contain only a single integer. Do not print any additional text such as Enter a number or The answer is.
3
7
7
5
9
8
1
15
提示
### SubtasksFor all testcases, the input will satisfy the following bounds:
- for all
- for all
Your program will be tested on input instances that satisfy the following restrictions:
| Subtask | Marks | Additional Constraints |
|---|---|---|
| Sample test cases | ||
| No additional constraints | ||
Sample Test Case 1 Explanation
You start at city . You then:
- Take the train from city to city ( units of time taken).
- Take the train from city to city ( units of time taken).
- Take the bus from city to city ( unit of time taken).
The total time taken is . 标签: P12192|贪心|2025|NOISG(新加坡)