CF764B.Timofey and cubes

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Young Timofey has a birthday today! He got kit of nn cubes as a birthday present from his parents. Every cube has a number aia_{i} , which is written on it. Timofey put all the cubes in a row and went to unpack other presents.

In this time, Timofey's elder brother, Dima reordered the cubes using the following rule. Suppose the cubes are numbered from 11 to nn in their order. Dima performs several steps, on step ii he reverses the segment of cubes from ii -th to (ni+1)(n-i+1) -th. He does this while i<=ni+1i<=n-i+1 .

After performing the operations Dima went away, being very proud of himself. When Timofey returned to his cubes, he understood that their order was changed. Help Timofey as fast as you can and save the holiday — restore the initial order of the cubes using information of their current location.

输入格式

The first line contains single integer nn ( 1<=n<=21051<=n<=2·10^{5} ) — the number of cubes.

The second line contains nn integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 109<=ai<=109-10^{9}<=a_{i}<=10^{9} ), where aia_{i} is the number written on the ii -th cube after Dima has changed their order.

输出格式

Print nn integers, separated by spaces — the numbers written on the cubes in their initial order.

It can be shown that the answer is unique.

输入输出样例

  • 输入#1

    7
    4 3 7 6 9 1 2
    

    输出#1

    2 3 9 6 7 1 4
  • 输入#2

    8
    6 1 4 2 5 6 9 2
    

    输出#2

    2 1 6 2 5 4 9 6

说明/提示

Consider the first sample.

  1. At the begining row was [ 22 , 33 , 99 , 66 , 77 , 11 , 44 ].
  2. After first operation row was [ 44 , 11 , 77 , 66 , 99 , 33 , 22 ].
  3. After second operation row was [ 44 , 33 , 99 , 66 , 77 , 11 , 22 ].
  4. After third operation row was [ 44 , 33 , 77 , 66 , 99 , 11 , 22 ].
  5. At fourth operation we reverse just middle element, so nothing has changed. The final row is [ 44 , 33 , 77 , 66 , 99 , 11 , 22 ]. So the answer for this case is row [ 22 , 33 , 99 , 66 , 77 , 11 , 44 ].
首页