#CCBCHBAHAI0000033. Đảo đoạn [l, r] (Reverse a Subarray [l, r])
Đảo đoạn [l, r] (Reverse a Subarray [l, r])
Đảo đoạn [l, r] (Reverse a Subarray [l, r])
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given an integer array and indices satisfying
Reverse the order of elements in the closed index interval , while leaving every element outside that interval unchanged.
Let the result be . For every :
$$b_i= \begin{cases} a_{l+r-i}, & l\le i\le r,\\ a_i, & \text{otherwise}. \end{cases}$$Print .
Input
The first line contains integers . The second line contains integers .
Output
Print the array after reversing the segment .
Subtask
Subtask 1 (100 points): ; ; .
Example
Input
7 2 5
1 2 3 4 5 6 7
Output
1 2 6 5 4 3 7
Explanation
The segment at indices is 3 4 5 6; reversing it gives 6 5 4 3. Indices 0, 1, and 6 remain unchanged.