题库练习 Ntarsis' Set
← 上一题 下一题 →

A16151 | Ntarsis' Set

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Ntarsis has been given a set $S$ , initially containing integers $1, 2, 3, \ldots, 10^{1000}$ in sorted order. Every day, he will remove the $a_1$ -th, $a_2$ -th, $\ldots$ , $a_n$ -th smallest numbers in $S$ simultaneously.

What is the smallest element in $S$ after $k$ days?

输入格式

Each test contains multiple test cases. The first line contains the number of test cases $t$ ( $1 \le t \le 10^5$ ). The description of the test cases follows.

The first line of each test case consists of two integers $n$ and $k$ ( $1 \leq n,k \leq 2 \cdot 10^5$ ) — the length of $a$ and the number of days.

The following line of each test case consists of $n$ integers $a_1, a_2, \ldots, a_n$ ( $1 \leq a_i \leq 10^9$ ) — the elements of array $a$ .

It is guaranteed that:

- The sum of $n$ over all test cases won't exceed $2 \cdot 10^5$ ;
- The sum of $k$ over all test cases won't exceed $2 \cdot 10^5$ ;
- $a_1 < a_2 < \cdots < a_n$ for all test cases.

输出格式

For each test case, print an integer that is the smallest element in $S$ after $k$ days.

输入输出样例

输入 #1
7
5 1
1 2 4 5 6
5 3
1 3 5 6 7
4 1000
2 3 4 5
9 1434
1 4 7 9 12 15 17 18 20
10 4
1 3 5 7 9 11 13 15 17 19
10 6
1 4 7 10 13 16 19 22 25 28
10 150000
1 3 4 5 10 11 12 13 14 15
输出 #1
3
9
1
12874
16
18
1499986
C++ 编辑器
输入
输出