-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1472D.java
More file actions
34 lines (32 loc) · 727 Bytes
/
1472D.java
File metadata and controls
34 lines (32 loc) · 727 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
30
31
32
33
34
import java.io.*;
import java.util.*;
public class Test{
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while (t-- > 0) {
int n = s.nextInt();
Integer[] arr = new Integer[n];
for (int i = 0; i < n; i++) {
arr[i] = s.nextInt();
}
Arrays.sort(arr);
Collections.reverse(Arrays.asList(arr));
long ans = 0;
for (int i = 0; i < n; i++) {
if (i % 2 == 0 && arr[i] % 2 == 0) {
ans += arr[i];
} else if (i % 2 == 1 && arr[i] % 2 == 1) {
ans -= arr[i];
}
}
if (ans > 0) {
System.out.println("Alice");
} else if (ans == 0) {
System.out.println("Tie");
} else {
System.out.println("Bob");
}
}
}
}