TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

There are n numbers A0,A1,...,An-1. Now you have to divide them no more than k group so that each group contains consecutive numbers (ex: you can divide 5 numbers in groups (A0, A1) (A2, A3, A4), but you cannot divide them in groups (A0, A1, A4) (A2, A3) ) so that the maximum sum S of numbers in certain group is minimum.
Please calculate the minimum value of S and there are how many ways can the n numbers be grouped so that S is minimum.

Input Format

There is a number of inputs.(at most 10)
There are two lines in each input. The first line have two number n and k. The second line have n number A0,A1,...,An-1

1<= n <= 50000, 1 <= k <= 1000

0 <= Ai <= 20000

Output Format

For each input, please print two number denoting the minimum value of S and the number of way that S is minimum(the second number may be very large, so you must print answer mod 10007).

Sample Input 1

10 6
3 2 1 3 5 8 3 2 1 2
3 3
1 1 10

Sample Output 1

8 31
10 2

Hints

Problem Source

Migrated from old NTUJ.

uva 11299

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 13000 65536 200