Skip to content

Commit 91d0411

Browse files
committed
Create 1638B-OddSwapSort.cpp
1 parent 938fc22 commit 91d0411

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

1638B-OddSwapSort.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <cstdio>
2+
3+
int main(){
4+
5+
long t; scanf("%ld", &t);
6+
while(t--){
7+
long n; scanf("%ld", &n);
8+
long a(-1), b(-1);
9+
bool res(true);
10+
while(n--){
11+
long x; scanf("%ld", &x);
12+
if(x % 2){
13+
if(a <= x){a = x;}
14+
else{res = false;}
15+
}
16+
else{
17+
if(b <= x){b = x;}
18+
else{res = false;}
19+
}
20+
}
21+
22+
puts(res ? "Yes" : "No");
23+
}
24+
25+
}

0 commit comments

Comments
 (0)