QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#13920. 回转寿司

Statistics

酷爱日料的小 Z 经常光顾学校东门外的回转寿司店。在这里,一盘盘寿司通过传送带依次呈现在小 Z 眼前。不同的寿司带给小 Z 的味觉感受是不一样的,我们定义小Z对每盘寿司都有一个满意度,例如小Z酷爱三文鱼,他对一盘三文鱼寿司的满意度为 10;小 Z 觉得金枪鱼没有什么味道,他对一盘金枪鱼寿司的满意度只有 5;小 Z 最近看了电影“美人鱼”,被里面的八爪鱼恶心到了,所以他对一盘八爪鱼刺身的满意度是 -100。

特别地,小 Z 是个著名的吃货,他吃回转寿司有一个习惯,我们称之为“狂吃不止”。具体地讲,当他吃掉传送带上的一盘寿司后,他会毫不犹豫地吃掉它后面的寿司,直到他不想再吃寿司了为止。今天,小 Z 再次来到了这家回转寿司店,$N$ 盘寿司将依次经过他的面前,其中,小 Z 对第 $i$ 盘寿司的满意度为 $A_i$。小 Z 可以选择从哪盘寿司开始吃,也可以选择吃到哪盘寿司为止,他想知道共有多少种不同的选择,使得他的满意度之和不低于 $L$,且不高于 $R$。

注意,虽然这是回转寿司,但是我们不认为这是一个环上的问题,而是一条线上的问题。即,小Z能吃到的是输入序列的一个连续子序列;最后一盘转走之后,第一盘并不会再出现一次。

输入格式

第一行包含三个整数 $N$,$L$ 和 $R$,分别表示寿司盘数,满意度的下限和上限。

第二行包含 $N$ 个整数 $A_i$,表示小 Z 对寿司的满意度。

输出格式

仅一行,包含一个整数,表示共有多少种选择可以使得小 Z 的满意度之和不低于 $L$ 且不高于 $R$。

样例数据

样例输入

5 5 9
1 2 3 4 5

样例输出

6

子任务

对于 $10\%$ 的数据,$N \leq 100$。

对于 $20\%$ 的数据,$N \leq 1\,000$。

另有 $10\%$ 的数据,$A_i \geq 0$,$L = 0$。

另有 $20\%$ 的数据,$A_i \geq 0$。

另有 $20\%$ 的数据,$|A_i| \leq 100$。

对于 $100\%$ 的数据,$N \le 100\,000$,$|A_i|≤100\,000$,$0 \le L,R \le 10^9$

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.