P15389 k-Shaoxing Sequence / splay
Description
A $k$-Shaoxing sequence is a very Shaoxing sequence, and today we will study it. For an integer $k$, a non-negative integer sequence $a$ of length $n$ is a $k$-Shaoxing sequence if and only if it satisfies the following condition:
$$
\min_{1\leq i
Input Format
**This problem contains multiple test cases.**
The first line of the input contains an integer $T$, the number of test cases.
The next $T$ groups of data follow, each with the following format:
The first line contains three integers $n, m, k$.
Output Format
For each test case, output one line containing a single integer, the corresponding answer.
Explanation/Hint
## Sample Explanation #1
This sample has $50$ test cases in total, with every $10$ test cases forming one big group, and the test cases in each big group have $n, m, k$ no greater than $8, 50, 500, 5000, 2 \times 10^{5}$ respectively.
For the sample with $n=2, m=7, k=1$: the sequence is a $k$-Shaoxing sequence if and only if there exist $i