Problem:


Score : 300 points

Problem Statement

You are given an integer sequence of length n, a_1, ..., a_n.
Let us consider performing the following n operations on an empty sequence b.

The i-th operation is as follows:

Append a_i to the end of b.

Reverse the order of the elements in b.

Find the sequence b obtained after these n operations.

Constraints

1 \leq n \leq 2\times 10^5

0 \leq a_i \leq 10^9

n and a_i are integers.

Input

Input is given from Standard Input in the following format:

n
a_1 a_2 ... a_n

Output

Print n integers in a line with spaces in between.
The i-th integer should be b_i.

Sample Input 1

4
1 2 3 4

Sample Output 1

4 2 1 3

After step 1 of the first operation, b becomes: 1.

After step 2 of the first operation, b becomes: 1.

After step 1 of the second operation, b becomes: 1, 2.

After step 2 of the second operation, b becomes: 2, 1.

After step 1 of the third operation, b becomes: 2, 1, 3.

After step 2 of the third operation, b becomes: 3, 1, 2.

After step 1 of the fourth operation, b becomes: 3, 1, 2, 4.

After step 2 of the fourth operation, b becomes: 4, 2, 1, 3.

Thus, the answer is 4 2 1 3.

Sample Input 2

3
1 2 3

Sample Output 2

3 1 2

As shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.

Sample Input 3

1
1000000000

Sample Output 3

1000000000

Sample Input 4

6
0 6 7 6 7 0

Sample Output 4

0 6 6 0 7 7



Sample input:
4
1 2 3 4


Sample output:
4 2 1 3

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
n=int(input())
A=list(map(int,input().split()))
b=[]
for i in range(n):
    if i%2==0:
        b.append("{}".format(A[i]))
    else:
        b.insert(0,"{}".format(A[i]))

if n%2==1:
    b.reverse()
    print(" ".join(b))
else:
    print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
ans = []
for i in range(N):
    if i % 2 == 0:
        ans.append(A[i])
    else:
        ans = [A[i]] + ans
if N % 2 != 0:
    print(*ans[::-1])
else:
    print(*ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
dList = list(map(int,input().split()))
result = []

for i in range(n):
  if (i % 2 == 0 and n % 2 == 0) or (i % 2 != 0 and n % 2 != 0):
   result.append(dList[i])
  else:
   result.insert(0,dList[i])

for i in result:
  print(i,end=" ")

print()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
dList = list(map(int,input().split()))
result = []

for i in range(n):
  if i % 2 == 0:
   result.insert(0,dList[i])
  else:
   result.append(dList[i])

if n % 2 == 0:
  for i in range(len(result)-1,-1,-1):
    print(result[i],end=" ")
else:
  for i in result:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
dList = list(map(int,input().split()))
result = []

for i in range(n):
  if i % 2 == 0:
   result.insert(0,dList[i])
  else:
   result.append(dList[i])

if n % 2 == 0:
  print(' '.join([str(result[i]) for i in range(len(result)-1,-1,-1)]))
else:
  print(' '.join([str(i) for i in result]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
lst = list(map(int,input().split()))
lst2 = []
for i in lst:
  lst2.append(i)
  lst2.reverse()
print(" ".join(map(str,lst2)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(len(a)):
    if i%2 == 0:
        b.append(str(a[i]))
    else:
        b.insert(0,str(a[i]))
if n%2 != 0:
    b.reverse()
    print(*b)
else:
    print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i,j in enumerate(a):
    if i%2 == 0:
        b.append(str(j))
    else:
        b.insert(0,str(j))
if j%2 != 0:
    b.reverse()
    print(' '.join(b))
else:
    print(' '.join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in a:
    b.append(str(i))
    b.reverse()
print(' '.join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))

b = []

for i in range(n):
    b.append(a[i])
    b = b[::-1]
print(*b)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
L=list(input().split())
B=[]
for i in range(N):
    B.append(L[i])
    B=B[::-1]
print(" ".join(B))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    b.append(a[i])
    b.reverse()
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b = [a[i]] + b
if n % 2 == 1:
    b.reverse()
print(' '.join(map(str, b)))

Submission status: Time Limit Exceeded

Solution code:
"""TLE
N = int(input())
sequence = list(input().split())
ans = []
for i in range(N):
    a_i = sequence[i]
    ans.append(a_i)
    ans = ans[::-1]
print(" ".join(ans))
"""

N = int(input())
sequence = list(input().split())
ans = []
for i in range(N):
    if i % 2 == N % 2:
        ans.append(sequence[i])
    else:
        ans.insert(0,sequence[i])
print(" ".join(ans))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=input().split()
b=[]

for i in range(n):
    b.append(a[i])
    b.reverse()
print(' '.join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    b.append(a[i])
    b = b[::-1]
print(' '.join(map(str, b)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = list(map(int, input().split()))

B = []

if len(A) %2 ==0:
    for idx, a in enumerate(A):

        if idx % 2 == 0:
            B.append(a)
        else:
            B.insert(0, a)

else:
    for idx, a in enumerate(A):

        if idx % 2 == 0:
            B.insert(0, a)
        else:
            B.append(a)
print(*B)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for x in a:
    b.append(x)
    b.reverse()
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = input().split()
if n % 2 == 0 :
    le = []
    lo = []
    for i in range(n) :
        if i % 2 == 0 :
            lo.append(a[i])
        else :
            le.append(a[i])
    le.reverse()
    l = le + lo
    S = ' '.join(l)
    print(S)
else :
    l = [a[0]]
    for i in range(1,n) :
        if i % 2 == 1 :
            l.append(a[i])
        else :
            l.insert(0,a[i])
    S = ' '.join(l)
    print(S)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = []
if n%2==0:
  for i in range(n):
    if i%2==0:
      ans.append(a[i])
    else:
      ans.insert(0,a[i])
    #print(*ans)
else:
  for i in range(n):
    if i%2==0:
      ans.insert(0,a[i])
    else:
      ans.append(a[i])
    #print(*ans)
print(*ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in a:
  ans.append(i)
  ans = ans[::-1]
print(*ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(n):
  if i%2==0:
    ans.append(a[i])
  else:
    ans.insert(0,a[i])
if n%2!=0:
  ans = ans[::-1]
print(*ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sequence = list(input().split())
ans = []
for i in range(N):
    a_i = sequence[i]
    ans.append(a_i)
    ans = ans[::-1]
print(" ".join(ans))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
sequence = list(map(int,input().split()))
ans = []
for i in range(N):
    a_i = sequence[i]
    ans.append(a_i)
    ans = ans[::-1]
print(" ".join([str(i) for i in ans]))

Submission status: Time Limit Exceeded

Solution code:
from collections import deque

n = int(input())
a = deque(map(int, input().split()))
b = deque()

for _ in range(n):
    b.append(a.popleft())
    b.reverse()

print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
ans = []
if n % 2 == 0:
    for i in range(0, n, 2):
        ans.append(a[i])
    for i in range(1, n, 2):
        ans.insert(0, a[i])
else:
    ans.append(a[0])
    for i in range(1, n, 2):
        ans.append(a[i])
    for i in range(2, n, 2):
        ans.insert(0, a[i])
print(*ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
ans = []
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 1: ans.insert(0, a[i])
        else: ans.append(a[i])
else:
    ans.append(a[0])
    for i in range(1, n):
        if i % 2 == 1: ans.append(a[i])
        else: ans.insert(0, a[i])
print(*ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
ans = []
for i in range(n):
    ans.append(a[i])
    ans.reverse()
print(*ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(N):
    if (i+1) % 2 == N % 2:
        ans = [a[i]] + ans
    else:
        ans = ans + [a[i]]
print(*ans, sep=" ")

Submission status: Time Limit Exceeded

Solution code:

N = int(input())
A = list(map(int, input().split()))

B = []

for i in range(N):
  B.append(A[i])
  B = B[::-1]
print(*B)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
arr = input().split()
arr = list(map(int,arr))

b = []
for i in range(n):
    if i % 2 == 0:
        b.append(arr[i])
    else:
        b.insert(0,arr[i])

if n % 2 == 0:
    pass
else:
    b.reverse()

for i in range(n-1):
    print(b[i], end = ' ')
print(b[-1])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
arr = input().split()
arr = list(map(int,arr))

b = []
for i in range(n):
    b.append(arr[i])
    b.reverse()

for i in range(n-1):
    print(b[i], end = ' ')
print(b[-1])

Submission status: Time Limit Exceeded

Solution code:
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
b_ls = []
for i, a in enumerate(a_ls):
    if i % 2 == 0:
        b_ls.append(a)
    else:
        b_ls = [a] + b_ls
if n % 2 == 1:
    b_ls.reverse()
print(" ".join([str(i) for i in b_ls]))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    b.append(a[i])
    b = b[::-1]
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    b.append(a[i])
    b = list(reversed(b))
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

a = list(map(int,input().split()))
b = []
#print(a)

for i in range(n):
    b.append(a[i])
    b = list(reversed(b))

print(*b)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = [-10000 for i in range(N)]
for i in range(N):
    if (N-i)%2 != 0:#from front
        index = (N-i)//2
        B[index] = A[i]
    else:# from backward
        index = N - (N-i)//2
        B[index] = A[i]
ans = ''
for e in B:
    ans += str(e)+' '
print(ans[:-1])

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
List=list(map(int,input().split()))
ans=[]
for i in range(n):
    if((i%2)!=(n%2)):
        ans.insert(0, List[i])
    else:
        ans.append(List[i])
print(' '.join(map(str,ans)))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
List=list(map(int,input().split()))
ans=[]
for i in range(n):
    if((i%2)!=(n%2)):
        ans.insert(0, List[i])
    else:
        ans.append(List[i])

for i in range(n):
    print(ans[i])

Submission status: Time Limit Exceeded

Solution code:
N = input()
B = []

for a in input().split():
  B.append(a)
  B = B[::-1]
print(*B)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    if  i % 2 == 1:
        b = b + [a[i]]
    else:
        b = [a[i]] + b
if n % 2 == 0:
    b.reverse()
print(' '.join(map(str,b)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in a:
    b.append(i)
    b.reverse()
print(' '.join(map(str,b)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in a:
    b.append(i)
    b.reverse()
print(' '.join(map(str,b)))

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
n=int(input())
a=list(map(int,input().split()))

s=deque()
for i in range(n):
    s.append(a[i])
    s.reverse()
    
print(*s)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
b = []

for i in range(n):
    b.append(a[i])
    b.reverse()

for i in range(n):
    if i < n-1:
        print(b[i],end=" ")
    else:
        print(b[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))

L = []
for a in A:
    L.append(a)
    L.reverse() 
print(*L)

Submission status: Time Limit Exceeded

Solution code:
def operation(i, ans_list) -> list:
    ans_list.append(i)
    ans_list.reverse()

    return ans_list

n = int(input())
input_list = list(map(str, input().split()))
ans_list = []

for i in input_list:
    operation(i, ans_list)

print(' '.join(ans_list))

Submission status: Time Limit Exceeded

Solution code:
import sys 
input=sys.stdin.readline

N=int(input())
A=[int(x) for x in input().split()]
B=[]
for i in range(N):
  if i%2==N%2:
    B=B+[A[i]]
  else:
    B=[A[i]]+B
print(*B)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
B=[]
for i in range(N):
  if i%2==N%2:
    B=B+[A[i]]
  else:
    B=[A[i]]+B
print(*B)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
B=[]
if N%2==0:
  for i in range(N):
    if i%2==0:
      B=B+[A[i]]
    else:
      B=[A[i]]+B
else:
  for i in range(N):
    if i%2==0:
      B=[A[i]]+B
    else:
      B=B+[A[i]]
print(*B)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = list(map(int, input().split()))
b = []
for i in range(N):
  if (i + N) % 2 == 0:
    b.append(S[i])
  else:
    b = [S[i]] + b[:]
for i in range(N - 1):
  print(b[i], end = ' ')
print(b[N - 1])

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = [int(x) for x in input().split()]
b = []
for i in range(n):
    b.append(a[i])
    b = b[::-1]
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    b.append(str(a[i]))
    b.reverse()
b = ' '.join(b)
print(b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    b.append(a[i])
    b.reverse()
b=[str(i) for i in b]
b = ' '.join(b)
print(b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = [a[0]]
if n%2==0:
    for i in range(1,n):
        if i%2==0:
            ans.append(a[i])
        else:
            ans.insert(0,a[i])
else:
    for i in range(1,n):
        if i%2==0:
            ans.insert(0,a[i])
        else:
            ans.append(a[i])
print(*ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = [i for i in map(str,input().split())]
length = len(A)
ans = []
if length%2 != 0:
  A.insert(0,str(-1))

while A:
  ans.append(A.pop(0))
  if not A: break
  ans.insert(0,A.pop(0))

if length%2 != 0:
  ans.remove(str(-1))
  print(*ans)
else:
  print(*ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = [int(i) for i in input().split()]
b = []
for i in range(n):
  b.append(A[i])
  b = b[::-1]
print(*b)

Submission status: Time Limit Exceeded

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = MAP()

B = deque([])

# print(A, B)

for a in A:
	B.append(a)
	B = deque(reversed(B))
	# print(B)

print(' '.join(map(str, B)))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = list(map(int, input().split()))
b = []
for i in range(N):
  if (i + N) % 2 == 0:
    b.append(S[i])
  else:
    b.insert(0, S[i])
for i in range(N - 1):
  print(b[i], end = ' ')
print(b[N - 1])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S = list(map(int, input().split()))
b = []
for i in range(N):
  if (i + N) % 2 == 0:
    b.append(S[0])
  else:
    b.insert(0, S[0])
  del S[0]
for i in range(N - 1):
  print(b[i], end = ' ')
print(b[N - 1])

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
n = int(input())
q = deque(map(int, input().split()))
ans = []
for i in q:
  ans.append(i)
  ans = ans[::-1]

print(*ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = map(int, input().split())
ans = []
for i in l:
  ans.append(i)
  ans = ans[::-1]

print(*ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
b = []
for a in A:
    b.append(a)
    b = b[::-1]
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))

b = []
for num in a:
  b += [str(num)]
  b = b[::-1]

print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
for i,j in enumerate(a):
    if (i+1) % 2 == 1:
        b.insert(0, j)
    else:
        b.append(j)
        
if len(a) % 2 == 0:
    for i in b[::-1]:
        print(i,end=" ")
else:
    for i in b:
        print(i,end=" ")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(str, input().split()))
b = []
for i in a:
    b.append(i)
    b = list(reversed(b))
print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = input().split()
b = []
for i in range(n):
    n = a[i]
    b.append(n)
    b = b[::-1]

print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = input().split()[::-1]
b = []
for i in range(n):
    n = a.pop()
    b.append(n)
    b = b[::-1]

print(*b)

Submission status: Time Limit Exceeded

Solution code:
n,*a=map(int,open(0).read().split())
b=[]
for i,j in zip(a[::2],a[1::2]):
    b=[j]+b+[i]
if n%2:
    b=[a[-1]]+b[::-1]
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
alis=list(map(int,input().split()))
blis=[]
for i in alis:
	blis.append(i)
	blis=blis[::-1]
print(*blis)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
alis=list(map(int,input().split()))
blis=[]
for i in range(n):
	blis.append(alis[i])
	blis=blis[::-1]
print(*blis)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = map(int, input().split())
b = []
for ai in a:
  b.append(str(ai))
  b = list(reversed(b))
print(' '.join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
li = list(map(int,input().split()))
ans = []

for i in range(n):
  ans.append(li[i])
  ans = list(reversed(ans))
for i in range(n):
  print(ans[i],end=" ")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    if (n + i) % 2 != 0:
        b.insert(0, a[i])
    else:
        b.append(a[i])
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    if (n + i) % 2 != 0:
        b.insert(0, a[i])
    else:
        b.append(a[i])
for i in b:
    print(i, " ", end="")
print()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    if (n + i) % 2 == 0:
        b.insert(0, a[i])
    else:
        b.append(a[i])
b = b[::-1]
for i in b:
    print(i, " ", end="")
print()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    b.append(a[i])
    b = b[::-1]
for i in b:
    print(i, " ", end="")
print()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = []
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            b.append(a[i])
        else:
            b.insert(0,a[i])
else:
    for i in range(n):
        if i % 2 != 0:
            b.append(a[i])
        else:
            b.insert(0,a[i])
for i in b:
    print(i, end=" ")

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
s=[]
for i in a:
  s.append(i)
  s.reverse()

print(" ".join(map(str,s)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
alist = list(map(int, input().split()))
b = []
for i in range(n):
    b.append(alist[i])
    b = b[::-1]

for _ in b:
    print(_, end=" ")

Submission status: Time Limit Exceeded

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
a=input().split()
ans=[]
for i in range(n):
    if n%2==0:
        if i%2!=0:
            ans.insert(0,a[i])
        else:
            ans.append(a[i])
    else:
        if i%2==0:
            ans.insert(0,a[i])
        else:
            ans.append(a[i])
ans=' '.join(ans)
if n==1:
    ans=a[0]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
a=input().split()
ans=''
for i in range(n):
    if n%2==0:
        if i%2!=0:
            if i==1:
                ans=a[i]+ans
            else:
                ans=a[i]+' '+ans
        else:
            ans+=' '+a[i]
    else:
        if i%2==0:
            if i==0:
                ans=a[i]+ans
            else:
                ans=a[i]+' '+ans
        else:
            ans+=' '+a[i]
if n==1:
    ans=a[0]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
ans=''
for i in range(n):
    if n%2==0:
        if i%2!=0:
            if i==1:
                ans=str(a[i])+ans
            else:
                ans=str(a[i])+' '+ans
        else:
            ans+=' '+str(a[i])
    else:
        if i%2==0:
            if i==0:
                ans=str(a[i])+ans
            else:
                ans=str(a[i])+' '+ans
        else:
            ans+=' '+str(a[i])
if n==1:
    ans=a[0]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=''
for i in range(n):
    if n%2==0:
        if i%2!=0:
            if i==1:
                ans=str(a[i])+ans
            else:
                ans=str(a[i])+' '+ans
        else:
            ans+=' '+str(a[i])
    else:
        if i%2==0:
            if i==0:
                ans=str(a[i])+ans
            else:
                ans=str(a[i])+' '+ans
        else:
            ans+=' '+str(a[i])
if n==1:
    ans=a[0]
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b = []
for i in a:
    b.append(i)
    b.reverse()

for i in b:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
if n%2==0:
    x=[]
    y=[]
    for i in range(n):
        if i%2==1:
            y=[a[i]]+y
        else:
            x.append(a[i])
    z=y+x
    print(*z)
else:
    x=[]
    y=[]
    for i in range(n):
        if i%2==0:
            y=[a[i]]+y
        else:
            x.append(a[i])
    z=y+x
    print(*z)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))

b = []
for i in range(n):
    b.append(a[i])
    b = b[::-1]
print(' '.join(map(str, b)))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
A=list(input().split())
B=[]
import queue
q=queue.Queue()
for a in A:q.put(a)
while not q.empty():
    B.append(q.get())
    B=B[::-1]
print(*B)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
A=list(input().split())
B=[]
import queue
q=queue.Queue()
for a in A:q.put(a)
while not q.empty():
    B.append(q.get())
    B=B[::-1]
print(" ".join(B))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
A=list(input().split())
B=[]
import queue
q=queue.Queue()
for a in A:q.put(a)
while not q.empty():
    B.append(q.get())
    B.reverse()
print(" ".join(B))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
A=list(input().split())
from collections import deque
q=deque()
for a in A:
    q.append(a)
    q.reverse()
print(" ".join(list(q)))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []

for i, num in enumerate(a):
    if i % 2 != 0:
        b.append(num)
    else:
        b.insert(0, num)

if n % 2 == 0:
    b = b[::-1]

print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []

for i in a:
    b.append(i)
    b = b[::-1]

print(*b)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
li = input().split()
ans = []
if N % 2 == 0:
    for i in range(N):
        if i % 2 == 0:
            ans.append(li[i])
        if i % 2 == 1:
            ans.insert(0,li[i])
else:
    for i in range(N):
        if i % 2 == 0:
            ans.insert(0,li[i])
        if i % 2 == 1:
            ans.append(li[i])
for i in range(N):
    print(ans[i],end=' ')

Submission status: Time Limit Exceeded

Solution code:
def main():
    X = int(input())
    # A = list(map(int, input().split()))
    A = input().split()

    b = []
    for ai in A:
        b.append(ai)
        b = b[::-1]
        # print(b)

    print(" ".join(b))

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = list(map(int, input().split()))
B = []

for i in range(n):
    B.append(A[i])
    B = B[::-1]

print(*B)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
l = []
for i in range(n):
    if n%2==0:
        if i%2==0:
            l.append(str(a[i]))
        else:
            l.insert(0,str(a[i]))
    if n%2!=0:
        if i%2!=0:
            l.append(str(a[i]))
        else:
            l.insert(0,str(a[i]))
print(' '.join(l))

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

n = int(input().rstrip())
a = [a for a in input().split()]

b = []
for i in range(n):
    if i % 2 == 0: b.append(a[i])
    else: b.insert(0, a[i])
if (n - 1) % 2 == 0: b = list(reversed(b))

for elem in b: print(elem, end=' ')

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline


n = int(input().rstrip())
a = [a for a in input().rstrip().split()]

b = []
for i in range(n):
    if i % 2 == 0: b += [a[i]]
    else: b = [a[i]] + b
if (n - 1) % 2 == 0: b = list(reversed(b))

for elem in b: print(elem, end=' ')

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))

B=[]

if(N%2==0):
    for i in range(N):
        if(i%2==1):
            B.insert(0,A[i])
        else:
            B.append(A[i])
else:
    for i in range(N):
        if(i%2==0):
            B.insert(0,A[i])
        else:
            B.append(A[i])
for i in B:
    print(i,end=" ")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(elem) for elem in input().split()]
b = []
for elem in a:
  b.append(elem)
  b = b[::-1]
b = [str(elem) for elem in b]
ans = ' '.join(b)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# ABC066 C - pushpush
# 2019/10/29

n ,*a = map(int, open(0).read().split())
# print(n, a)

b=[]
if n%2 == 0:
    for i in range(n):
        if i%2!=0:
            b.insert(0,a[i])
        else:
            b.append(a[i])
#         print(i, b)
else:
    for i in range(n):
        if i%2==0:
            b.insert(0,a[i])
        else:
            b.append(a[i])
#         print(i, b)
        
# print(b)
print(" ".join([str(i) for i in b]))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
Data = list(map(int,input().split()))
Ans = []
if len(Data) % 2 == 0:
    m = len(Data) // 2
    for i in range(m):
        Ans.insert(0,Data[2*i+1])
    for i in range(m):
        Ans.append(Data[2*i])
else:
    m = len(Data) // 2
    for i in range(m+1):
        Ans.insert(0,Data[2*i])
    for i in range(m):
        Ans.append(Data[2*i+1])

for a in Ans:
    print(a,end=' ')

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
Data = list(map(int,input().split()))
Ans = []
for d in Data:
    Ans.append(d)
    Ans.reverse()
for a in Ans:
    print(a, end=' ')

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(N):
    B.append(A[i])
    B=B[::-1]
print(*B)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
A = list(map(int,input().split()))
B = []
for a in A:
    B.append(a)
    B = B[::-1]
print(*B,sep=" ")

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))

ans = []

for i,x in enumerate(a):
    if i%2 == (n-1)%2:
        ans.insert(0,x)
    else:
        ans.append(x)

print(*ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = []

for i in range(n):
    b.append(a[i])
    b.reverse()

print(*b)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l1=[]
l=[int(i) for i in input().split()]
for i in l:
    l1.append(i)
    l1=l1[::-1]
print(*l1)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
li=list(map(int,input().split()))
ans=[]
if N%2==0:
    for n in range(N):
        if n%2==0:
            ans.append(str(li[n]))
        else:
            ans.insert(0,str(li[n]))
else:
    for n in range(N):
        if n%2==0:
            ans.insert(0,str(li[n]))
        else:
            ans.append(str(li[n]))
print(' '.join(ans))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
li=list(map(int,input().split()))
ans=[]
for n in range(N):
    a=str(li[n])
    ans.append(a)
    ans.reverse()
print(' '.join(ans))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(len(a)):
    b.append(a[i])
    b=b[::-1]
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
b_list = []

for a_i in a_list:
  b_list.append(a_i)
  b_list = b_list[::-1]
  
print(*b_list)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(str,input().split()))
l=[a[0]]
if n%2==0:
    for i in range(1,n):
        if i%2==1:
            l=[a[i]]+l
        else:
            l=l+[a[i]]
    print(" ".join(map(str,l)))
else:
    for i in range(1,n):
        if i%2==0:
            l=[a[i]]+l
        else:
            l=l+[a[i]]
    print(" ".join(map(str,l)))