Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
34821 | 方巾予 | 【S】T1 | C++ | 通过 | 100 | 253 MS | 8264 KB | 594 | 2024-11-14 18:50:20 |
#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; }