#CCBCHBAHAI0000027. Đảo mảng tại chỗ - n chẵn/lẻ (In-place Array Reversal - Even/Odd Length)
Đảo mảng tại chỗ - n chẵn/lẻ (In-place Array Reversal - Even/Odd Length)
Đảo mảng tại chỗ - n chẵn/lẻ (In-place Array Reversal - Even/Odd Length)
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given an integer array .
Reverse it in place by swapping symmetric pairs
for
When is odd, the middle element at index is never moved by a swap.
Print the array after all swaps.
Input
The first line contains integer . The second line contains space-separated integers .
Output
Print the elements after the in-place reversal on one line.
Subtasks
Subtask 1 (100 points): ; .
Example
Input
5
10 20 30 40 50
Output
50 40 30 20 10
Explanation
Swap and . The middle element remains in place.