← 返回 rippling 的题目列表Delivery Problem
类型:online_judge
Problem Description
Given a series of delivery orders, each with a start and end point, plan a delivery route to complete all orders in the shortest time possible. Calculate and output the shortest time required to complete all orders.
Input Format
n: Number of delivery orders.
The next n lines each contain two integers representing the start and end points of an order.
Output Format
Output an integer representing the shortest time needed to complete all delivery orders.
Constraints
1 <= n <= 1000
0 <= start, end <= 100000
Example
Input
3
1 5
2 8
4 6
Output
3
Explanation
The routes given (1->5), (2->8), and (4->6) denote the sequence and operations of deliveries.
Example
Input
3
1 5
2 8
4 6