提交时间:2024-11-14 18:50:20
运行 ID: 34821
#include<bits/stdc++.h> using namespace std; const int N=1e6+10; int n,a[N],fl; deque<int> q; signed main(){ fl=0; scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); if(!fl){ q.push_front(a[i]); }else{ q.push_back(a[i]); } fl=1-fl; } if(fl){ while(!q.empty()){ printf("%d ",q.front()); q.pop_front(); } }else{ while(!q.empty()){ printf("%d ",q.back()); q.pop_back(); } } return 0; }