-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame.java
More file actions
30 lines (26 loc) · 758 Bytes
/
Copy pathGame.java
File metadata and controls
30 lines (26 loc) · 758 Bytes
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
import java.io.*;
import java.util.*;
public class Game {
public static void main(String args[] ) throws Exception {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(--t>=0) {
int size = in.nextInt();
int[] villians = new int[size];
int[] heroes = new int[size];
for (int i=0; i<size; i++) villians[i] = in.nextInt();
for (int j=0; j<size; j++) heroes[j] = in.nextInt();
if (canWin(villians, heroes)) System.out.println("WIN");
else System.out.println("LOSE");
}
//Write code here
}
public static boolean canWin(int[] villians, int[] heroes) {
Arrays.sort(villians);
Arrays.sort(heroes);
for (int i=0; i<villians.length; i++) {
if (villians[i] > heroes[i]) return false;
}
return true;
}
}