QOJ.ac

QOJ

Límite de tiempo: 5 s Límite de memoria: 1024 MB Puntuación total: 100

#5585. 创造性会计

Estadísticas

在核算企业利润时,我们可以将连续的天数划分为固定长度的段,并计算每一段的利润(即该段内所有每日利润之和)。例如,我们可以选择七天为一个段,按周利润进行核算。我们还可以灵活选择段的起始日期。例如,对于周利润,我们可以从周日、周一甚至周三开始计算。选择不同的段起始日期有时会改变账面上的利润表现,使其对投资者更具(或更不具)吸引力。

例如,我们可以将十天的连续利润(或亏损,亏损记为负利润)划分为三天的段,如下所示:

$3, 2, -7 \mid 5, 4, 1 \mid 3, 0, -3 \mid 5$

这得到了四段,利润分别为 $-2, 10, 0, 5$。在此划分方式下,允许在开头和结尾出现长度小于固定段长的部分段。如果一段的利润严格大于 $0$,我们称该段为盈利段。在上述例子中,四段中只有两段是盈利的。

如果我们尝试不同的起始日期,可以得到:

$3, 2 \mid -7, 5, 4 \mid 1, 3, 0 \mid -3, 5$

这得到了四段,利润分别为 $5, 2, 4, 2$。四段全部盈利,这使得我们的业务看起来更加稳定。

给定一份连续日期的利润列表以及一个整数范围,如果我们可以在该范围内选择任意段长,并为核算选择任意起始日期,那么我们能够得到的盈利段数量的最小值和最大值分别是多少?

输入格式

第一行包含三个空格分隔的整数 $n, \ell$ 和 $h$ ($1 \le \ell \le h \le n \le 3 \times 10^4, h - \ell \le 1000$),其中 $n$ 是账面上的天数,$\ell$ 是段长的最小可选值,$h$ 是段长的最大可选值。

接下来的 $n$ 行,每行包含一个整数 $p$ ($-10^4 \le p \le 10^4$),按顺序表示每日利润。

输出格式

在一行中输出两个空格分隔的整数 $min$ 和 $max$,其中 $min$ 是可能的最少盈利段数量,$max$ 是可能的最多的盈利段数量。$min$ 和 $max$ 均是在所有可能的段长(在 $\ell$ 到 $h$ 之间)和所有可能的起始日期选择下取得的。

样例

样例输入 1

10 3 5
3
2
-7
5
4
1
3
0
-3
5

样例输出 1

2 4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.