The Game Of Stacks
All submissions for this problem are available.
The game of stacks is played among K players as follows: Initially there are N stacks of coins where the i'th stack has X(i) coins. In his turn, each player can choose any stack and remove any number of coins ( greater than 0 ) from it. The player who is not able to pick any coin during his turn will be considered the worst ranked player. The players following him will be ranked 2nd worst, 3rd worst, and so on.
You have been asked to play first. You have decided to play the game if and only if your rank is not bound to be the worst assuming that each player plays optimally. You need to output "Play" if your rank is not bound to be the worst, and "Not Play" otherwise.
The first line contains the number of test cases T, at most 20, followed by T test cases. Each test case begins on a new line containing the values of N and K, where 1 <= N <= 100,000 and 1 <= K <= 100,000. The next line contains N space separated integers X(1), X(2),..., X(N) where for each i, 1 <= X(i) <= 100,000,000.
For each test case in the input, you need to output "Play" if you rank is not bound to be the worst, and "Not Play" otherwise. Print the result of each test case on a new line.
Input: 2 5 3 1 2 3 4 5 5 3 5 6 3 1 6 Output: Play Not Play
|Time Limit:||1 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, JS, 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.