-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Array_Coloring.java
More file actions
105 lines (89 loc) · 5.61 KB
/
Copy pathA_Array_Coloring.java
File metadata and controls
105 lines (89 loc) · 5.61 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import java.io.*;
import java.util.*;
public class A_Array_Coloring {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st = new StringTokenizer("");
static PrintWriter out = new PrintWriter(System.out);
void solve() throws IOException {
int n=nextInt();
int[]a=new int[n];
int odd=0;
for(int i=0;i<n;i++){
a[i]=nextInt();
if(a[i]%2==1)
odd++;
}
if(odd%2==0)
{
System.out.println("YES");
}
else
System.out.println("NO");
}
public static void main(String[] args) throws IOException {
int t = 1;
t = nextInt(); // Uncomment for multiple test cases
while (t-- > 0) {
new A_Array_Coloring().solve();
}
out.close();
}
static String next() throws IOException {
while (!st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
return st.nextToken();
}
static int nextInt() throws IOException { return Integer.parseInt(next()); }
static long nextLong() throws IOException { return Long.parseLong(next()); }
static double nextDouble() throws IOException { return Double.parseDouble(next()); }
static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
static long gcd(long a, long b) { return b == 0 ? a : gcd(b, a % b); }
static long lcm(long a, long b) { return a / gcd(a, b) * b; }
static int binarySearch(int[] arr, int key) {
int low = 0, high = arr.length - 1;
while (low <= high) {
int mid = (low + high) >>> 1;
if (arr[mid] == key) return mid;
else if (arr[mid] < key) low = mid + 1;
else high = mid - 1;
}
return -1;
}
static void sort(int[] arr) {
Arrays.sort(arr);
}
static void sort(long[] arr) {
Arrays.sort(arr);
}
static int[] readIntArray(int n) throws IOException {
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = nextInt();
return a;
}
static long[] readLongArray(int n) throws IOException {
long[] a = new long[n];
for (int i = 0; i < n; i++) a[i] = nextLong();
return a;
}
}
/*
▄▄▄▄ ▄▄▄ ███▄ █ ██ ▄█▀▄▄▄ ██▓
▓█████▄ ▒████▄ ██ ▀█ █ ██▄█▒▒████▄ ▓██▒
▒██▒ ▄██▒██ ▀█▄ ▓██ ▀█ ██▒▓███▄░▒██ ▀█▄ ▒██▒
▒██░█▀ ░██▄▄▄▄██ ▓██▒ ▐▌██▒▓██ █▄░██▄▄▄▄██ ░██░
░▓█ ▀█▓ ▓█ ▓██▒▒██░ ▓██░▒██▒ █▄▓█ ▓██▒░██░
░▒▓███▀▒ ▒▒ ▓▒█░░ ▒░ ▒ ▒ ▒ ▒▒ ▓▒▒▒ ▓▒█░░▓
▒░▒ ░ ▒ ▒▒ ░░ ░░ ░ ▒░░ ░▒ ▒░ ▒ ▒▒ ░ ▒ ░
░ ░ ░ ▒ ░ ░ ░ ░ ░░ ░ ░ ▒ ▒ ░
░ ░ ░ ░ ░ ░ ░ ░ ░
░
▄████▄ ▒█████ ▓█████▄ ▓█████ █████▒██▓ ███▄ █ ██▓ ██████ ██░ ██ ▓█████ ▓█████▄
▒██▀ ▀█ ▒██▒ ██▒▒██▀ ██▌▓█ ▀ ▓██ ▒▓██▒ ██ ▀█ █ ▓██▒▒██ ▒ ▓██░ ██▒▓█ ▀ ▒██▀ ██▌
▒▓█ ▄ ▒██░ ██▒░██ █▌▒███ ▒████ ░▒██▒▓██ ▀█ ██▒▒██▒░ ▓██▄ ▒██▀▀██░▒███ ░██ █▌
▒▓▓▄ ▄██▒▒██ ██░░▓█▄ ▌▒▓█ ▄ ░▓█▒ ░░██░▓██▒ ▐▌██▒░██░ ▒ ██▒░▓█ ░██ ▒▓█ ▄ ░▓█▄ ▌
▒ ▓███▀ ░░ ████▓▒░░▒████▓ ░▒████▒ ░▒█░ ░██░▒██░ ▓██░░██░▒██████▒▒░▓█▒░██▓░▒████▒░▒████▓
░ ░▒ ▒ ░░ ▒░▒░▒░ ▒▒▓ ▒ ░░ ▒░ ░ ▒ ░ ░▓ ░ ▒░ ▒ ▒ ░▓ ▒ ▒▓▒ ▒ ░ ▒ ░░▒░▒░░ ▒░ ░ ▒▒▓ ▒
░ ▒ ░ ▒ ▒░ ░ ▒ ▒ ░ ░ ░ ░ ▒ ░░ ░░ ░ ▒░ ▒ ░░ ░▒ ░ ░ ▒ ░▒░ ░ ░ ░ ░ ░ ▒ ▒
░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ▒ ░░ ░ ░ ░ ░░ ░ ░ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
░ ░ ░
*/