#P16755. [GKS 2020 #C] Countdown

    ID: 17016 Type: RemoteJudge 1000ms 1024MiB Tried: 0 Accepted: 0 Difficulty: 1 Uploaded By: Tags>模拟2020Google Kick Start

[GKS 2020 #C] Countdown

题目描述

Avery has an array of NN positive integers. The i-th integer of the array is AiA_i.

A contiguous subarray is an mm-countdown if it is of length mm and contains the integers m,m−1m, m-1, m−2,...,2,1m-2, ..., 2, 1 in that order. For example, [3,    2,    1][3, \;\; 2, \;\; 1] is a 33-countdown.

Can you help Avery count the number of KK-countdowns in her array?

输入格式

The first line of the input gives the number of test cases, TT. TT test cases follow. Each test case begins with a line containing the integers NN and KK. The second line contains NN integers. The i-th integer is AiA_i.

输出格式

For each test case, output one line containing Case #x: y, where xx is the test case number (starting from 11) and yy is the number of KK-countdowns in her array.

3
12 3
1 2 3 7 9 3 2 1 8 3 2 1
4 2
101 100 99 98
9 6
100 7 6 5 4 3 2 1 100
Case #1: 2
Case #2: 0
Case #3: 1

提示

In sample case #1, there are two 3-countdowns as highlighted below.

  • 1 2 3 7 9 3 2 1 8 3 2 1
  • 1 2 3 7 9 3 2 1 8 3 2 1

In sample case #2, there are no 2-countdowns.

In sample case #3, there is one 6-countdown as highlighted below.

  • 100 7 6 5 4 3 2 1 100

Limits

1≤T≤1001 \le T \le 100.

2≤K≤N2 \le K \le N.

1≤Ai≤2×1051 \le A_i \le 2 \times 10^5, for all ii.

Test Set 1

2≤N≤10002 \le N \le 1000.

Test Set 2

2≤N≤2×1052 \le N \le 2 \times 10^5 for at most 1010 test cases.

For the remaining cases, 2≤N≤10002 \le N \le 1000.