PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000280. Chia mảng tối ưu (Splitting an Array)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Chia mảng tối ưu (Splitting an Array)
Splitting an Array
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Partition a positive integer array into exactly nonempty contiguous blocks, each element belonging to exactly one block. Minimize the largest block sum. This PHOJ adaptation uses locally defined limits.
Input
First line: . Second line: integers .
Output
Print the optimal value.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; .
Examples
Input 1
5 3
2 4 7 3 5
Output 1
8
Explanation
Blocks [2,4], [7], [3,5] have sums 6,7,8. A cap of 7 needs at least four blocks.