PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000030. Cắt gỗ (Wood Cutting)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Cắt gỗ (Wood Cutting)
Wood Cutting
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
There are customers. Customer requests several wood pieces; the service time is the sum of cutting times for those pieces. Only one customer can be served at a time. A customer's completion time is when all their pieces are done. Minimize the average completion time.
Input
The first line contains . Each of the next lines starts with , followed by cutting times.
Output
Print the minimum average completion time with exactly 10 digits after the decimal point.
Constraints
- .
- for .
- .
- for .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): Full constraints.
Examples
Input
3
2 4 6
1 2
3 1 1 1
Output
7.3333333333
Explanation
The sample follows the ordering rule described in the Vietnamese explanation and produces the shown optimum.