Loading repovive.com/contests/5/problems/B
You are given an array of integers.
You can perform the following operation any number of times (possibly zero): Choose two adjacent elements and . If they have different parities (i.e., one is even and the other is odd), you can swap them.
Determine whether it is possible to sort the array in non-decreasing order using this operation.
We can only swap and to get , and then swap and to get . It is impossible to fully sort this array using the given operations.
We can sort the array with the following operations:
The array is now sorted.