Split into k sub-arrays
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given array of elements and number . Split the given array into sub-arrays (they must cover all the elements). The maximum sub-array sum achievable out of sub-arrays formed, must be minimum possible. Find that possible sub-array sum.
Input
First line contains two numbers and . Second line contains positive integers, each no more than .
Output
Print the minimum possible sub-array sum.
Examples
For the first sample the optimal split is . Maximum sum of all sub-arrays is , which is minimum possible for subarrays.
For the second sample the optimal split is . Maximum sum of all sub-arrays is , which is minimum possible for subarrays.
Input #1
Answer #1
Input #2
Answer #2
Submissions 1K
Acceptance rate 41%