Problem M
Creative Accounting
When accounting for the profit of a business, we can divide consecutive days into fixed-sized segments and calculate each segment’s profit as the sum of all its daily profits. For example, we could choose seven-day segments to do our accounting in terms of weekly profit. We also have the flexibility of choosing a segment’s starting day. For example, for weekly profit we can start a week on a Sunday, Monday, or even Wednesday. Choosing different segment starting days may sometimes change how the profit looks on the books, making it more (or less) attractive to investors.
As an example, we can divide ten consecutive days of profit (or loss, which we denote as negative profit) into three-day segments as such:
This gives us four segments with profit
If we try a different starting day, we can obtain:
This gives us four segments with profit
You’re given a list of consecutive days of profit, as well as an integer range. If we can choose any segment size within that range and any starting day for our accounting, what is the minimum and maximum number of profitable segments that we can have?
Input
The first line of input has three space-separated integers
Each of the next
Output
Output on a single line two space-separated integers
Sample Input 1 | Sample Output 1 |
---|---|
10 3 5 3 2 -7 5 4 1 3 0 -3 5 |
2 4 |