CF1840C.Ski Resort

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Dima Vatrushin is a math teacher at school. He was sent on vacation for nn days for his good work. Dima has long dreamed of going to a ski resort, so he wants to allocate several consecutive days and go skiing. Since the vacation requires careful preparation, he will only go for at least kk days.

You are given an array aa containing the weather forecast at the resort. That is, on the ii-th day, the temperature will be aia_i degrees.

Dima was born in Siberia, so he can go on vacation only if the temperature does not rise above qq degrees throughout the vacation.

Unfortunately, Dima was so absorbed in abstract algebra that he forgot how to count. He asks you to help him and count the number of ways to choose vacation dates at the resort.

迪马·瓦特鲁申是一名中学数学教师。由于工作表现优异,他获得了 nn 天的假期。迪马一直梦想着去滑雪场度假,因此他打算选择若干连续的天数去滑雪。但由于假期需要精心准备,他只会在至少持续 kk 天的情况下出行。

你将获得一个数组 aa,其中包含滑雪场的天气预报:即第 ii 天的气温为 aia_i 摄氏度。

迪马出生于西伯利亚,因此他只有在整个假期期间气温均不高于 qq 摄氏度时,才会前往度假。

不幸的是,迪马沉迷于抽象代数,以至于忘记了如何计数。他请你帮他计算:在滑雪场选择度假日期的方案总数。

输入格式

The first line of the input contains an integer tt (1≤t≤1041 \le t \le 10^4) — the number of test cases.

Then follow the descriptions of the test cases.

The first line of each test case contains three integers nn, kk, qq (1≤n≤2⋅1051 \le n \le 2 \cdot 10^5, 1≤k≤n1 \le k \le n, −109≤q≤109-10^9 \le q \le 10^9) — the length of the array aa, the minimum number of days at the resort, and the maximum comfortable temperature for Dima.

The second line of each test case contains nn integers a1,a2,a3,…,ana_1, a_2, a_3, \dots, a_n (−109≤ai≤109-10^9 \le a_i \le 10^9) — the temperature at the ski resort.

The sum of all nn values over all test cases does not exceed 2⋅1052 \cdot 10^5.

输入的第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4)——测试用例的数量。

接下来是各测试用例的描述。

每个测试用例的第一行包含三个整数 nn、kk、qq(1≤n≤2⋅1051 \le n \le 2 \cdot 10^5,1≤k≤n1 \le k \le n,−109≤q≤109-10^9 \le q \le 10^9)——分别表示数组 aa 的长度、Dima 在度假村所需的最少天数,以及 Dima 感到舒适的最高温度。

每个测试用例的第二行包含 nn 个整数 a1,a2,a3,…,ana_1, a_2, a_3, \dots, a_n(−109≤ai≤109-10^9 \le a_i \le 10^9)——表示滑雪场每天的温度。

所有测试用例的 nn 值之和不超过 2⋅1052 \cdot 10^5。

输出格式

Output tt integers, each of which is the answer to the corresponding test case — the number of ways for Dima to choose vacation dates at the resort.

输出 tt 个整数,每个整数对应一个测试用例的答案——即季马在度假村选择度假日期的方案数。

输入输出样例

  • 输入#1

    7
    3 1 15
    -5 0 -10
    5 3 -33
    8 12 9 0 5
    4 3 12
    12 12 10 15
    4 1 -5
    0 -1 2 5
    5 5 0
    3 -1 4 -5 -3
    1 1 5
    5
    6 1 3
    0 3 -2 5 -4 -4

    输出#1

    6
    0
    1
    0
    0
    1
    9

说明/提示

In the first test case of the example, Dima can go on any day, so the suitable dates for him are [1], [2], [3], [1, 2], [2, 3], [1, 2, 3].

In the second and fourth test cases of the example, Dima cannot go on any day due to the high temperature, so there are no suitable dates.

In the third test case of the example, Dima can only go on the dates [1, 2, 3].

在示例的第一个测试用例中,迪马可以在任意一天出行,因此适合他的日期为 [1]、[2]、[3]、[1, 2]、[2, 3]、[1, 2, 3]。

在示例的第二和第四个测试用例中,由于气温过高,迪马无法在任何一天出行,因此不存在合适的日期。

在示例的第三个测试用例中,迪马只能在日期 [1, 2, 3] 出行。

输入解题思路,AI测评打分。不知道怎么写?

首页