The Game Of StacksProblem code: CB07 |
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.
Input
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.
Output
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.
Example
Input: 2 5 3 1 2 3 4 5 5 3 5 6 3 1 6 Output: Play Not Play
| Author: | moneymachine |
| Date Added: | 17-01-2010 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

Please check the sample
Please check the sample output
output should be
Not Play
Not Play
Or input may be wrong
Please reply
Please reply
ya ! agree !
ya ! agree !
The sample input output is
The sample input output is correct.