All submissions for this problem are available.
Our friend Hannibal from NITK Surathkal was one of the k participants in the elite tournament Micapokalebe. The rules of the game to decide the ranking of the players for the tournament are as follows. There are n stacks of coins. The ith stack has x(i) coins. Each player gets to choose any one stack and pick any available number of coins greater than zero from that stack. The player who is unable to pick any coin from any stack during his move is the last(worst) ranked player. The players following him in order by turn will be considered second last ranked player, third last ranked player etc. Hannibal is asked to play first. Hannibal decides that he will not protest unless his tournament rank is bound to be the worst. Assuming all players in the tournament are rational and want to achieve the best rank possible, your job is to advice Hannibal with a simple "Yes" or "No" answer asking to protest or not to protest respectively given a configuration of the stacks.
The first line give t, the number of test cases (t ≤ 250),
Then t test cases follow.
For each test case:
The first line gives 2 integers n k, denoting the number of stacks and number of participants respectively.
The next line gives n integers x(1) x(2) x(3) .... x(n) denoting the number of coins in each stack.
(1 ≤ k ≤ n ≤ 105)
(1≤ x(i) ≤109)
For each test case output a single line.
"Yes" if he has to protest , "No" if he shouldn't
Input: 2 5 4 6 4 2 1 2 5 2 5 6 3 1 6 Output: No Yes
|Time Limit:||0.12 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, ERL, SQL, kotlin, PERL6, TEXT, CPP17, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.