PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000046. Phân ca tài xế xe buýt (The Bus Driver Problem)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Phân ca tài xế xe buýt (The Bus Driver Problem)
The Bus Driver Problem
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
A city has drivers, morning routes and evening routes. Each driver must receive one of each. A total route length exceeding incurs overtime of per excess unit. Minimize total overtime cost.
Input
Line 1: . Line 2: morning lengths. Line 3: evening lengths.
Output
Print the minimum total overtime cost.
Subtasks
- Subtask 1 (20 points): ; ; ; all route lengths are in .
- Subtask 2 (30 points): ; ; ; all route lengths are in .
- Subtask 3 (50 points): ; ; ; all route lengths are in .
Examples
Input
2 20 5
10 15
10 15
Output
50
Explanation
Pair the 10 and 15 routes twice. Each driver exceeds 20 by 5, incurring . Total cost is 50.