311391: CF1980B. Choosing Cubes

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Choosing Cubestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Dmitry has $n$ cubes, numbered from left to right from $1$ to $n$. The cube with index $f$ is his favorite.

Dmitry threw all the cubes on the table, and the $i$-th cube showed the value $a_i$ ($1 \le a_i \le 100$). After that, he arranged the cubes in non-increasing order of their values, from largest to smallest. If two cubes show the same value, they can go in any order.

After sorting, Dmitry removed the first $k$ cubes. Then he became interested in whether he removed his favorite cube (note that its position could have changed after sorting).

For example, if $n=5$, $f=2$, $a = [4, \color{green}3, 3, 2, 3]$ (the favorite cube is highlighted in green), and $k = 2$, the following could have happened:

  • After sorting $a=[4, \color{green}3, 3, 3, 2]$, since the favorite cube ended up in the second position, it will be removed.
  • After sorting $a=[4, 3, \color{green}3, 3, 2]$, since the favorite cube ended up in the third position, it will not be removed.
Input

The first line contains an integer $t$ ($1 \le t \le 1000$) — the number of test cases. Then follow the descriptions of the test cases.

The first line of each test case description contains three integers $n$, $f$, and $k$ ($1 \le f, k \le n \le 100$) — the number of cubes, the index of Dmitry's favorite cube, and the number of removed cubes, respectively.

The second line of each test case description contains $n$ integers $a_i$ ($1 \le a_i \le 100$) — the values shown on the cubes.

Output

For each test case, output one line — "YES" if the cube will be removed in all cases, "NO" if it will not be removed in any case, "MAYBE" if it may be either removed or left.

You can output the answer in any case. For example, the strings "YES", "nO", "mAyBe" will be accepted as answers.

ExampleInput
12
5 2 2
4 3 3 2 3
5 5 3
4 2 1 3 5
5 5 2
5 2 4 1 3
5 5 5
1 2 5 4 3
5 5 4
3 1 2 4 5
5 5 5
4 3 2 1 5
6 5 3
1 2 3 1 2 3
10 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1
42
5 2 3
2 2 1 1 2
2 1 1
2 1
5 3 1
3 3 2 3 2
Output
MAYBE
YES
NO
YES
YES
YES
MAYBE
MAYBE
YES
YES
YES
NO

Output

题目大意:
德米特里有一些编号为1到n的立方体,其中编号为f的立方体是他的最爱。他将所有立方体扔在桌子上,每个立方体显示一个值a_i(1≤a_i≤100)。之后,他按照立方体显示的值从大到小的顺序排列它们,如果两个立方体显示相同的值,它们可以以任何顺序排列。排列后,德米特里移除了前k个立方体,然后他想知道是否移除了他最喜欢的立方体(注意,在排序后它的位置可能已经改变了)。

输入输出数据格式:
输入:
- 第一行包含一个整数t(1≤t≤1000),表示测试用例的数量。接下来是每个测试用例的描述。
- 每个测试用例的第一行包含三个整数n、f和k(1≤f, k≤n≤100),分别表示立方体的数量、德米特里最喜欢的立方体的编号和移除的立方体的数量。
- 每个测试用例的第二行包含n个整数a_i(1≤a_i≤100),表示立方体显示的值。

输出:
- 对于每个测试用例,输出一行。如果最喜欢的立方体在所有情况下都会被移除,输出“YES”;如果最喜欢的立方体在任何情况下都不会被移除,输出“NO”;如果可能被移除或保留,输出“MAYBE”。
- 答案不区分大小写,例如“YES”、“nO”、“mAyBe”都是可接受的答案。题目大意: 德米特里有一些编号为1到n的立方体,其中编号为f的立方体是他的最爱。他将所有立方体扔在桌子上,每个立方体显示一个值a_i(1≤a_i≤100)。之后,他按照立方体显示的值从大到小的顺序排列它们,如果两个立方体显示相同的值,它们可以以任何顺序排列。排列后,德米特里移除了前k个立方体,然后他想知道是否移除了他最喜欢的立方体(注意,在排序后它的位置可能已经改变了)。 输入输出数据格式: 输入: - 第一行包含一个整数t(1≤t≤1000),表示测试用例的数量。接下来是每个测试用例的描述。 - 每个测试用例的第一行包含三个整数n、f和k(1≤f, k≤n≤100),分别表示立方体的数量、德米特里最喜欢的立方体的编号和移除的立方体的数量。 - 每个测试用例的第二行包含n个整数a_i(1≤a_i≤100),表示立方体显示的值。 输出: - 对于每个测试用例,输出一行。如果最喜欢的立方体在所有情况下都会被移除,输出“YES”;如果最喜欢的立方体在任何情况下都不会被移除,输出“NO”;如果可能被移除或保留,输出“MAYBE”。 - 答案不区分大小写,例如“YES”、“nO”、“mAyBe”都是可接受的答案。

加入题单

上一题 下一题 算法标签: