-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path20309(Sort).java
More file actions
36 lines (31 loc) · 946 Bytes
/
20309(Sort).java
File metadata and controls
36 lines (31 loc) · 946 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
35
36
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
StringTokenizer st;
int N = Integer.parseInt(br.readLine());
boolean success = true;
st = new StringTokenizer(br.readLine());
for(int i = 1; i < N + 1; i++) {
int temp = Integer.parseInt(st.nextToken());
if(temp % 2 == 0){
if(i % 2 != 0){
success = false;
break;
}
}else{
if(i % 2 == 0){
success = false;
break;
}
}
}
if(success){
System.out.println("YES");
}else{
System.out.println("NO");
}
}
}