Xiao Ming increases the difficulty of the game

TimeLimit:15000MS  MemoryLimit:256MB
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description

Xiao Ming is ACM's Dalao in the grade (this Xiao Ming is not That Xiaoming), and the classmates once asked Xiao Ming a question:

Give you a sequence A containing n integers, asking what is the value of the m-th largest interval sum? (interval and no de-duplication).

For example, A={1,2,3,4,4}, then Sum[2,5] = 2 + 3 + 4 + 4 = 13.

It is well known that n numbers have a total of n*(n+1)/2 intervals, and how many intervals have how many interval sum.

The arrogant Xiao Ming thinks that this question is too simple and does not want to answer. In order to suppress the arrogant Xiao Ming, the classmates added a rule to Xiao Ming:

The same number in the interval can only be calculated up to k times.

That is, for the above sequence A, when k=1, Sum[2,5] = 2 + 3 + 4 = 9. (At this time, the number 4 can only be calculated once)

Xiao Ming was beaten back to the original form, but he want to save his face and secretly came to you to help him solve this problem. Can you help him?

这题还是不会翻译

Input

The first line have three integer n, m, k.

The second line of n numbers represents the n integers of sequence A.

(1<=n, k<=1e5. 1<=m<=min(1e5, n*(n+1)/2). |a[i]| <= 1e9)

Output

Outputs a line of integers representing the value of the m-th largest interval sum.

SampleInput
10 6 2
2 2 2 -2 -2 -2 1 1 1 -1
SampleOutput
2
Submit
题目统计信息详细
总AC数3
通过人数2
尝试人数3
总提交量6
AC率33.33%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: