ALGO ARTIS プログラミングコンテスト2023 秋 (AtCoder Regular Contest 168)
E
Subsegments with Large Sums
AtCoder
⌀ 3001
原题
← DF →
翻译中…

Problem Statement

翻译中…

You are given a sequence of positive integers $A=(A_1,A_2,\cdots,A_N)$ of length $N$.

翻译中…

Consider dividing this sequence into $K$ non-empty contiguous subsequences. Among these $K$ contiguous subsequences, the number of ones whose sum of elements is at least $S$ will be called the score. Find the maximum value of the score.

翻译中…

Constraints

翻译中…
  • $1 \leq K \leq N \leq 250000$
  • $1 \leq A_i \leq 10^9$
  • $1 \leq S \leq 10^{15}$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N K S
A_1 A_2 \cdots A_N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
4 3 6
1 4 2 8
Output #1
2
If the sequence is divided into $(1),(4,2),(8)$, the score will be $2$. No higher score can be achieved, so the answer is $2$.
Input #2
10 5 2
1 1 1 1 1 1 1 1 1 1
Output #2
5
Input #3
10 5 3
1 1 1 1 1 1 1 1 1 1
Output #3
2
Input #4
20 6 946667802
786820955 250480341 710671229 946667801 19271059 404902145 251317818 22712439 520643153 344670307 274195604 561032101 140039457 543856068 521915711 857077284 499774361 419370025 744280520 249168130
Output #4
6
题目信息
题号
arc168_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。