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:
import bisect,copy,heapq,itertools,math,string
from collections import *
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
b = [i for i in range(n)]

for i in range(n):
    b.remove(i)
    b.append(i)
    b.reverse()

c = [a[b[i]] for i in range(n)]
print(*c)

Submission status: Time Limit Exceeded

Solution code:
ls = []
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    if i%2==0:
        ls = [a[i]]+ls
    else:
        ls.append(a[i])
if n%2 == 0:
    print(*reversed(ls))
else:
    print(*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 = list(reversed(b))
print(*b)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

ans=[a[1]]

if n%2==0:
    for i in range(2, n+1):
        if i%2==0:
            ans=[a[i]]+ans
        else:
            ans=ans+[a[i]]

else:
    for i in range(2, n+1):
        if i%2==0:
            ans=ans+[a[i]]
        else:
            ans=[a[i]]+ans

print(*ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

x = 0
if n % 2 != 0:
    b.insert(0,a[x])
    x += 1

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

print(*b)

Submission status: Time Limit Exceeded

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

x = 0
if n % 2 != 0:
    b.insert(0,a[x])
    x += 1

for i in range(x,n):
    if(i % 2 == 0):
        b.append(a[i])
    else:
        b.insert(0,a[i])
if n % 2 != 0:
    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]
s = ' '.join([str(e) for e in b])
print(s)

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    n = int(input().strip())
    array = list(map(int, input().strip().split(' ')))
    b = []
    for i in range(n):
        if i % 2 != 0:
            b.append(array[i])
        else:
            b.insert(0,array[i])
    if n % 2 == 0:
        b.reverse()
    for i in range(n):
        if i == 0:
            ans = str(b[i])
        else:
            ans = ans + ' ' + str(b[i])
    print(ans)
resolve()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

def main():
    n = int(input())
    #n,m = map(int, input().split())
    a = list(input().split())
    b = []
    for i in range(len(a)):
        if i%2 == 0:
            b.insert(n-1,a[i])
        else:
            b.insert(0,a[i])
    if n%2 == 1:
        b.reverse()
    print(' '.join(b))

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
def resolve():
    n = int(input().strip())
    array = list(map(int, input().strip().split(' ')))
    b = deque()
    for i in range(n):
        if i % 2 == 0:
            b.append(array[i])
        else:
            b.appendleft(array[i])
    if n % 2 == 1:
        b.reverse()
    for i in range(n):
        if i == 0:
            ans = str(b[i])
        else:
            ans = ans + ' ' + str(b[i])
    print(ans)
resolve()

Submission status: Time Limit Exceeded

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

b = []
tmp = []

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

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

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    n = int(input().strip())
    array = list(map(int, input().strip().split(' ')))
    b = []
    for i in range(n):
        b.append(array[i])
        b.reverse()
    for i in range(n):
        if i == 0:
            ans = str(b[i])
        else:
            ans = ans + ' ' + str(b[i])
    print(ans)
resolve()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

a = [e for e in input().split(" ")]
res = []

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

print(" ".join(res))

Submission status: Time Limit Exceeded

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

b = []
tmp = []

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

if n%2 == 0:
    for s in range(n):
        tmp.append(b[n-1-s])
    
    print(" ".join(tmp))

else:
    print(" ".join(b))

Submission status: Time Limit Exceeded

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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

b = []

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

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

print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
n  = int(input())
a  = list(map(str, 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 = [x for x in input().split()]
b = []
for i in range(n):
    b.append(a[i])
    b.reverse()
    
print(*b, sep=' ')

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(input().split())
ans = a[0]
for i in range(n):
	if i%2 == 0 and i != 0:
		ans = ans + ' ' + a[i]
	elif i%2 != 0:
		ans = a[i] + ' ' + ans
if n%2 != 0 and n != 1:
	print(ans[::-1])
else:
	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())
a = list(map(int, input().split()))
b = []
c = ''
 
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 = []
c = ''

for i in range(n):
    b.append(a[i])
    b.reverse()
for j in b:
    c += str(j) + ' '
print(c)

Submission status: Time Limit Exceeded

Solution code:
# ABC 066 C
N = int(input())
A = input().split()

tmp = []
for i,a in enumerate(A):
    if i %2!=0:
        tmp.insert(0,a)
    else:
        tmp.append(a)
if N%2!=0:
    tmp.reverse()
print(' '.join(tmp))

Submission status: Time Limit Exceeded

Solution code:
# ABC 066 C
N = int(input())
A = input().split()

tmp = []
for i,a in enumerate(A):
    if i %2!=0:
        tmp.insert(0,a)
    else:
        tmp.append(a)
if N%2!=0:
    tmp=tmp[::-1]
print(' '.join(tmp))

Submission status: Time Limit Exceeded

Solution code:
# ABC 066 C
N = int(input())
A = input().split()

tmp = []
for i,a in enumerate(A):
    if i %2!=0:
        A =list(a)
        A.extend(tmp)
        tmp=A
    else:
        tmp.append(a)
if N%2!=0:
    tmp=tmp[::-1]
print(' '.join(tmp))

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((input().split()))
b=[]
for i in range(n):
    b.append(a[i])
    b=b[::-1]
print(' '.join(b))

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+=[A[i]]
    else:
        ans=[A[i]]+ans
if(i%2==0):
    print(*ans[::-1])
else:
    print(*ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)


n=l()[0]
A=l()
ans=[]
for i in range(n):
    if(i%2==0):
        ans+=[A[i]]
    else:
        ans=[A[i]]+ans
if(i%2==0):
    print(*ans[::-1])
else:
    print(*ans)

Submission status: Time Limit Exceeded

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

for i in range(n):
  ans.append(a[i])
  ans.reverse()
  
S = ""
for i in range(n- 1):
  S+= str(ans[i])+ " "
  
S+= str(ans[n- 1])
  
print(S)

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.insert(0,A[i])

if N%2==0:
    print(*B)
else:
    print(*B[::-1])

Submission status: Time Limit Exceeded

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

B = []
for a in A:
    B.append(a)
    B = B[::-1]

print(' '.join(B))

Submission status: Time Limit Exceeded

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

B = []
for a in A:
    B.append(str(a))
    B = B[::-1]

print(' '.join(B))

Submission status: Time Limit Exceeded

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

b = []
for t in a:
    b.append(t)
    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 range(n):
  b.append(a.pop(0))
  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=[]
ans=""
for i in range(n):
  b.append(a[i])
  b.reverse()
print(*b)

Submission status: Time Limit Exceeded

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

b = []
for i in range(n):
    ai = al[i]
    b.append(str(ai))
    b.reverse()
print(' '.join(b))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(map(str,input().split()))
b=[]
#print(b)
for i in range(n):
    b.append(a[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 a:
    b.append(i)
    b = b[::-1]
print(' '.join(map(str,b)))

Submission status: Time Limit Exceeded

Solution code:
def solve():
  n = int(input())
  a = list(map(int, input().split()))
  b = []
  for i in range(n):
    if i % 2 == n % 2:
      b.append(a[i])
    else:
      b.insert(0,a[i])
  b = map(str, b)
  print(" ".join(b))
  return 0
 
if __name__ == "__main__":
  solve()

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]
  
b=[str(c) for c in b]
b=" ".join(b)
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)

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    a=list(input().split())
    b=[]
    for i in range(1,n+1):
        if i%2==n%2:
            b.insert(0,a[i-1])
        else:
            b.append(a[i-1])
    print(*b)
resolve()

Submission status: Time Limit Exceeded

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

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 = [str(A[i])] + B
        
if n % 2 == 1:
    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:
    B = [A[i]] + B
  else:
    B.append(A[i])
    
if n%2:
  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:
    B = [A[i]] + B
  else:
    B = B + [A[i]]
    
if n%2:
  B = B[::-1]
print(*B)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
#from collections import deque
s=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(0,s):
  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 = []

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
seq = [x for x in input().split(' ')]

b = []

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

print(' '.join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
seq = [x for x in input().split(' ')]

b = []

for i in range(n):
    b.append(seq[i])
    
    start = 0
    end = i

    while (start <= end):
        temp = b[end]
        b[end] = b[start]
        b[start] = temp
        start += 1
        end -= 1
    

print(' '.join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
seq = [x for x in input().split(' ')]

b = []

for i in range(n):
    b.append(seq[i])
    c = []
    for j in range(i, -1, -1):
        c.append(b[j])
    
    b = c

print(' '.join(b))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
seq = [x for x in input().split(' ')]

b = []

for i in range(n):
    curr = seq[i]
    b.append(curr)
    c = b[i::-1]
    b = c

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):
    if i%2==0:
        b.append(a[i])
    else:
        b.insert(0, a[i])
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 range(n):
    b.append(a[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 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 = [int(i) for i in input().split()]
b = []
for i in a:
    b.append(i)
    b.reverse()
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(i) for i in 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())
*A, = map(int, input().split())
b = []
for a in A:
    if a%2==n%2:
        b.insert(0,a)
    else:
        b.append(a)
print(*b)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
*A, = 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 = []
if n%2:
    flag = True
else:
    flag = False
for i in range(n):
    if (i+1)%2:
        b.append(a[i])
    else:
        b.insert(0,a[i])
if flag:
    print(*b[::-1])
else:
    print(*b)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = sl()
    qu = collections.deque(A)
    ret = []
    re = False
    for q in qu:
        if re:
            ret.append(q)
            ret = ret[::-1]
            re = False
        else:
            ret.append(q)
            ret = ret[::-1]
            re = True
    print(' '.join(ret))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

    b= []
    cnt = 0
    while cnt < n:
        b = b[::-1] + [a[cnt]]
        cnt += 1


    return b[::-1]
    

print(*solve())

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.reverse()

print(' '.join(b))

Submission status: Time Limit Exceeded

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

print(" ".join(list(map(str, a))))

Submission status: Time Limit Exceeded

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

ans = []
if not n % 2:
    ans.append(a[0])
    a = a[1:]

while len(a) > 1:
    ans.insert(0, a[0])
    ans.append(a[1])
    a = a[2:]

if len(a):
    ans.insert(0, a[0])

print(*ans)

Submission status: Time Limit Exceeded

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

ans = []
for i in range(len(a)):
  ans.append(a[i])
  ans = ans[::-1]

print(" ".join(list(map(str, ans))))

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 = ans[::-1]
print(*ans)

Submission status: Time Limit Exceeded

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

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 n % 2 != i % 2:
        b.insert(0, a[i])
    else:
        b.append(a[i])
print(' '.join(map(str, b)))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

if n % 2 == 0:
  for x in range(n):
    if x % 2 == 0:
      b.append(a[x])
    else:
      b.insert(0, a[x])
else:
  for y in range(n):
    if y % 2 == 1:
      b.append(a[y])
    else:
      b.insert(0, a[y])

print(" ".join(b))

Submission status: Time Limit Exceeded

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

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

print(" ".join(b))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [int(x) for x in 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 i in range(n):
    t = i%2
    if t == 0:
        b.append(a[i])
    else:
        b.insert(0, a[i])

if n%2 == 1:
    for i in range(1,n+1):
        print(b[-i], end=' ')
else:
    for i in range(n):
        print(b[i], end=' ')

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

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

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

if n%2 == 1:
    for i in range(int(n/2)):
        b[i], b[-(i+1)] = b[-(i+1)], b[i]
    
for i in range(n):
    print(b[i], end=' ')

Submission status: Time Limit Exceeded

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
n = INT()
a = LIST()
b = []

for i in range(1, n+1):
	b.append(a[i-1])
	b.reverse()

for i in range(len(b)):
	print(b[i], "", end="")
print()

Submission status: Time Limit Exceeded

Solution code:
def main2():
    N = int(input().strip())
    r_stack=[]
    stack=[]
    for n in input().split():
        n = int(n)
        if len(r_stack)%2!=0:
            stack.append(n)
            r_stack.insert(0,n)
        else:
            stack.insert(0,n)
            r_stack.append(n)
    if N % 2 ==0:
        print(*r_stack)
    else:
        print(*stack)

if __name__ == "__main__":
    main2()

Submission status: Time Limit Exceeded

Solution code:
def main2():
    N = int(input().strip())
    r_stack=[]
    stack=[]
    for n in input().split():
        n = int(n)
        if len(r_stack)==0:
            stack.append(n)
            r_stack.append(n)
        elif len(r_stack)%2!=0:
            stack.append(n)
            r_stack.insert(0,n)
        else:
            stack.insert(0,n)
            r_stack.append(n)
    if N % 2 ==0:
        print(*r_stack)
    else:
        print(*stack)

if __name__ == "__main__":
    main2()

Submission status: Time Limit Exceeded

Solution code:
def main2():
    N = int(input().strip())
    r_stack=[]
    stack=[]
    for n in input().split():
        n = int(n)
        if len(r_stack)==0:
            stack.append(n)
            r_stack.append(n)
        elif len(r_stack)%2!=0:
            stack.append(n)
            r_stack.insert(0,n)
        else:
            stack.insert(0,n)
            r_stack.append(n)
    if N % 2 ==0:
        ans_list=[str(num) for num in r_stack]
        ans=' '.join(ans_list)
    else:
        ans_list=[str(num) for num in stack]
        ans=' '.join(ans_list)
    print(ans)

if __name__ == "__main__":
    main2()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input().strip())
    init_array=[]
    stack=[]
    [init_array.append(int(i)) for i in (input().split())]
    for v in init_array:
        if len(stack)==0:
            stack.append(v)
            continue
        else:
            stack.append(v)
            stack.reverse()
    ans_list=[str(num) for num in stack]
    ans=' '.join(ans_list)
    print(ans)


if __name__ == "__main__":
    main()

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!=n%2:
        ans.insert(0,a[i])
    else:
        ans.append(a[i])
for i in ans:
    print(i,end=" ")

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==1:
        ans.append(a[i])
    else:
        ans.insert(0,a[i])
if n%2==0:
    ans.reverse()
for i in ans:
    print(i,end=" ")

Submission status: Time Limit Exceeded

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

if c%2 == 0:
  b = b[::-1]
  print(*b)
else:
  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 = 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=list(reversed(b))

for i in b:
    print(i,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 i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.insert(0, a[i])

if n % 2 != 0:
    b.reverse()
for i in b:
    print(i, end=" ")

Submission status: Time Limit Exceeded

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

for i in li:
    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 i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.insert(0, a[i])
if n % 2 == 1:
    b.reverse()

for i in range(n):
    print(b[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 i % 2 == n % 2:
        b.append(a[i])
    else:
        b.insert(0, a[i])
print(' '.join(map(str, b)))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=list(input().split())
if n==1:
  print(a[0])
  exit()
bl=a[-1]
br=a[-2]
for i in range(2,n):
  if i%2==0:
    bl+=' '+a[-1-i]
  else:
    br=a[-1-i]+' '+br
bl+=' '+br
print(bl)

Submission status: Time Limit Exceeded

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

if n % 2 == 1:
    ans.reverse()
print(*ans)

Submission status: Time Limit Exceeded

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

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 = B[::-1]

print(*B)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
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())
l = list(map(int, input().split()))
ans = []

if N % 2 == 0:
    flag = 0
else:
    flag = 1

for ix,i in enumerate(l):
    if ix % 2 == flag:
        ans.append(i)
    else:
        ans.insert(0, i)
    
print(" ".join(map(str, ans)))