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:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, COB, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, kotlin, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.5, RUBY, rust, SCALA, SCM chicken, SCM guile, SCM qobi, ST, swift, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.