Submission #3811541


Source Code Expand

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n;
  cin>>n;
  int a[n];
  REP(i, n)cin>>a[i];
  if(n==1){
    cout<<a[0]<<endl;
    return 0;
  }

  deque<int> b;
  b.push_back(a[0]);
  FOR(i, 1, n){
    if((i+n)%2) b.push_front(a[i]);
    else b.push_back(a[i]);
  }

  REP(i, n-1)cout<<b[i]<<" ";
  cout<<b[n-1]<<endl;


  return 0;
}

Submission Info

Submission Time
Task C - pushpush
User howahowa
Language C++14 (GCC 5.4.1)
Score 300
Code Size 876 Byte
Status AC
Exec Time 104 ms
Memory 3840 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 12
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt, sample4.txt
All even_0.txt, even_1.txt, even_2.txt, even_3.txt, odd_0.txt, odd_1.txt, odd_2.txt, odd_3.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt
Case Name Status Exec Time Memory
even_0.txt AC 104 ms 3840 KB
even_1.txt AC 100 ms 3840 KB
even_2.txt AC 100 ms 3840 KB
even_3.txt AC 100 ms 3840 KB
odd_0.txt AC 100 ms 3840 KB
odd_1.txt AC 100 ms 3840 KB
odd_2.txt AC 100 ms 3840 KB
odd_3.txt AC 100 ms 3840 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB
sample4.txt AC 1 ms 256 KB