#CCBCHBAHAI0000028. Đổi chỗ từng cặp kề nhau (Swap Adjacent Pairs)
Đổi chỗ từng cặp kề nhau (Swap Adjacent Pairs)
Đổi chỗ từng cặp kề nhau (Swap Adjacent Pairs)
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given an integer array .
Swap consecutive elements pair by pair from left to right:
If is odd, the final element has no partner and remains unchanged.
Let the resulting array be . For every such that ,
If is odd, additionally .
Print .
Input
The first line contains integer . The second line contains space-separated integers .
Output
Print the elements after swapping adjacent pairs on one line.
Subtasks
Subtask 1 (100 points): ; .
Example
Input
7
1 2 3 4 5 6 7
Output
2 1 4 3 6 5 7
Explanation
The pairs , , and are swapped; the final value remains unchanged.