아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Creative Accounting

시간 제한5초메모리 제한1024 MB

요약
n일치 일별 이익과 구간 길이 범위가 주어질 때, 길이와 시작 위치를 정해 합이 양수인 구간 개수의 최솟값과 최댓값을 구한다.
난이도

보통10점 중 7점

유형
누적 합, 수학, 완전 탐색
정답자
아직 제출이 없습니다

문제

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:

3,2,−7:∣:5,4,1:∣:3,0,−3:∣:53, 2, {-7} \\:|\\: 5, 4, 1 \\:|\\: 3, 0, {-3} \\:|\\: 5

This gives us four segments with profit −2,10,0,5-2, 10, 0, 5. For the purpose of this division, partial segments with fewer than the fixed segment size are allowed at the beginning and at the end. We say a segment is profitable if it has a strictly positive profit. In the above example, only two out of the four segments are profitable.

If we try a different starting day, we can obtain:

3,2:∣:−7,5,4:∣:1,3,0:∣:−3,53, 2 \\:|\\: {-7}, 5, 4 \\:|\\: 1, 3, 0 \\:|\\: {-3}, 5

This gives us four segments with profit 5,2,4,25, 2, 4, 2. All four segments are profitable, which makes our business look much more consistent.

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?

입력

The first line of input has three space-separated integers nn, ℓ\ell and hh (1≤ℓ≤h≤n≤3×1041 \le \ell \le h \le n \le 3 \times 10^4, h−ℓ≤1,000h - \ell \le 1\\,000), where nn is the number of days in the books, ℓ\ell is the minimum possible choice of segment size, and hh is the maximum possible choice of segment size.

Each of the next nn lines contains a single integer pp (−104≤p≤104-10^4 \le p \le 10^4). These are the daily profits, in order.

출력

Output on a single line two space-separated integers minmin and maxmax, where minmin is the minimum number of profitable segments possible, and maxmax is the maximum number of profitable segments possible. Both minmin and maxmax are taken over all possible choices of segment size between ℓ\ell and hh and all possible choices of starting day.

예제1

  1. 예제 1

    입력
    10 3 5
    3
    2
    -7
    5
    4
    1
    3
    0
    -3
    5
    
    예상 출력
    2 4