-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWIN OR LOSE PROBLEM TECHGIG
More file actions
78 lines (67 loc) · 2.04 KB
/
WIN OR LOSE PROBLEM TECHGIG
File metadata and controls
78 lines (67 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#A new fighting game has become popular. There are N number of villains in it, each having some strength. There are N number of players in the game with each having some energy.
The energy is used to kill the villains. A villain can be killed only if the energy of the player is greater than the strength of the villain.
Maxi is playing the game and at a particular time wants to know if it is possible for him to win the game or not with the given set of energies and strengths of players and villains.
Maxi wins the game if his players can kill all the villains with the allotted energy.
Note: The fight is one-one.
Input Format
The first line of input consists of number of test cases, T.
The first line of each test case consists of number of villains and player, N.
The second line of each test case consists of the N space-separated strengths of Villains.
The third line of each test case consists of N space-separated energy of players.
Constraints
1<= T <=10
1<= N <=1000
1<= strength , energy <=100000
Output Format
For each test case, Print WIN if all villains can be killed else print LOSE in separate lines.
Sample TestCase 1
Input
1
6
112 243 512 343 90 478
500 789 234 400 452 150
Output
WIN
Explanation
For the given test case, If we shuffle the players and villains, we can observe that all the villains can be killed by players.
500>478 WIN
789>512 WIN
234>112 WIN
400>243 WIN
452>343 WIN
150>90 WIN
As all the villains can be killed by the players, MAXI will WIN the game. Thus, the final output is WIN.
Sample TestCase 2
Input
2
6
10 20 50 100 500 400
30 20 60 70 90 490
5
10 20 30 40 50
40 50 60 70 80
Output
LOSE
WIN
```
def main():
t=int(input())
while(t>0):
n=int(input())
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l1.sort()
l2.sort()
c=0
for i in range(0,n):
if(l2[i]>l1[i]):
c=c+1
else:
continue
if(c==n):
print("WIN")
else:
print("LOSE")
t=t-1
main()
```