CF1994C Hungry Games
题目描述
### 题目大意
Yaroslav 正在玩一款电脑游戏,他的角色遇到了 $n$ 个蘑菇,第 $i$ 个蘑菇的毒性定义为 $a_i$。Yaroslav 可以选择两个整数 $1\le l\le r\le n$,并操控他的角色依次食用第 $l,l+1,\dots,r$ 个蘑菇。
Yaroslav 的角色有一个中毒属性 $g$,初始为 $0$。当他食用第 $i$ 个蘑菇时,$g$ 会增加 $a_i$,若此时 $g$ 超过了一个预设的最大中毒值 $x$,则 $g$ 会重置为 $0$。
Yaroslav 想知道有多少种选择 $l,r$ 的方案能使他的角色食用完蘑菇后,中毒属性 $g$ 不为 $0$。
输入格式
输入数据的第一行包括一个整数 $t\left(1\le t\le10^4\right)$,表示测试用例的组数。
对于每个测试用例:
- 第一行包括两个整数$n,x$ $\left(1\le n\le2\times10^5,1\le x\le10^9\right)$。
- 第二行包括 $n$ 个整数,依次表示 $a_1,a_2,\dots,a_n$ $\left(1\le a_i \le10^9\right)$。
保证 $\sum n \le 2\times 10^5$
输出格式
对于每个测试用例,输出一个整数,即符合题目条件的方案数。
说明/提示
In the first test case, the subsegments $ (1, 1) $ , $ (1, 2) $ , $ (1, 4) $ , $ (2, 2) $ , $ (2, 3) $ , $ (3, 3) $ , $ (3, 4) $ and $ (4, 4) $ are suitable.
In the second test case, non-zero $ g $ will remain only on the subsegments $ (1, 1) $ and $ (2, 2) $ .
In the third test case, on the only possible subsegment, $ g $ will be zero.