Optical Illusion


Submit solution

Points: 4 (partial)
Time limit: 1.0s
Memory limit: 256M

Problem type

Anders loves optics. While exploring a funhouse, he found his favorite room: the mirror maze! But these mirrors are unusual — they only reflect parts of an image, leaving the rest unchanged.

This broke everything Anders thought he knew about reflections. He held up an array of items, and the mirrors reflected only a certain subarray — reversing it while keeping the rest the same.

He sends you the resulting reflected array and the reflected range, and challenges you to determine what the original array looked like.

Task

Given the final array and the reflected segment, reconstruct the original array.

A reflection is represented by reversing the corresponding subarray.

Input Specification

The first line contains three integers: \(n\), \(L\), and \(R\)
\((1 ≤ L ≤ R ≤ n ≤ 10^5)\)

  • \(n\) is the size of the array
  • \(L\) and \(R\) represent the inclusive range of indices that were reflected

The second line contains \(n\) integers between \(0\) and \(100\) (inclusive), representing the array after reflection.

Output Specification

Output \(n\) integers: the original array before reflection.

Sample Input 1

4 2 3
1 3 2 4

Sample Output 1

1 2 3 4

Sample Input 2

6 4 6
100 5 51 51 92 39

Sample Output 2

100 5 51 39 92 51

Comments

There are no comments at the moment.