CF2123B.Tournament

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Tournament

You are given an array of integers a1,a2,,ana_1,a_2,\dots,a_n. A tournament is held with nn players. Player ii has strength aia_i.

While more than kk players remain,

  • Two remaining players are chosen at random;
  • Then the chosen player with the lower strength is eliminated. If the chosen players have the same strength, one is eliminated at random.

Given integers jj and kk (1j,kn1 \leq j,k \leq n), determine if there is any way for player jj to be one of the last kk remaining players.

Input

The first line contains an integer tt (1t1041 \leq t \leq 10^4)  — the number of test cases.

The first line of each test case contains three integers nn, jj, and kk (2n21052\leq n \leq 2\cdot 10^5, 1j,kn1\leq j, k\leq n).

The second line of each test case contains nn integers, a1,a2,,ana_1,a_2,\dots,a_n (1ain1\leq a_i\leq n).

It is guaranteed that the sum of nn over all test cases does not exceed 21052\cdot 10^5.

Output

For each test case, output on a single line "YES" if player jj can be one of the last kk remaining players, and "NO" otherwise.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Note

In the first sample, suppose that players 22 and 55 are chosen. Then player 22 defeats player 55. Now, the remaining player strengths are

3 2 4

Next, suppose that players 33 and 44 are chosen. Then player 33 might defeat player 44. Now, the remaining player strengths are

3 2 4

Player 22 is one of the last three players remaining.

In the third sample, it can be shown that there is no way for player 11 to be the last player remaining.

Samples

3
5 2 3
3 2 4 4 1
5 4 1
5 3 4 5 2
6 1 1
1 2 3 4 5 6
YES
YES
NO

在线编程 IDE

建议全屏模式获得最佳体验