Catch Umm Catch
All submissions for this problem are available.
Sana is playing a game with her friend called Catch Um Catch. Her friend is throwing a ball at her, and every ball is marked with a single number K. She first announces the number written on that ball and then throws it towards Sana. While the ball is in air, Sana has to decide whether to catch it or not. Suppose she catches a ball with a number (say K) written on it. Now if she decides to catch a ball with a number less than or equal to K, all the balls she has caught till now will not be counted. She will win if she catches more balls than she drops.
You are Sana’s friend and thus you want her to win. Somehow you get to know the sequence in which she will throw the balls.
Given this sequence of numbers on each ball, you need to maximize the number of catches so as to assure that Sana wins.
Assume that Sana never misses a catch if she wishes to take it. You have to find whether she can win this round or not, even if she is able to maximize the number of catches.
The first line of the input contains a single integer T denoting the number of test cases (the number of rounds). The description for T test cases follows. Each test case starts with a single line consisting of a single integer N, the number of balls she is going to throw. The next line contains N space separated integers denoting the number on each ball to be thrown.
For each test case, output on a single line “WIN” (without quotes) if she is going to win the round, otherwise output “LOSE” (without quotes).
1 <= T <=10^4
1 <= N<= 10^3
0 < K< 10^8
5 9 6 8 10
3 1 2 8 6 9
8 5 6 4 3 2
HINT: Use printf() & scanf() instead of cin cout for faster results
Problem Set By: Gaurav Dubey, 3rd Year
|Time Limit:||0.344101 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, 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, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.