Submission #3811514


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;
  }

  int b[n];
  if(n%2){
    REP(i, n/2+1) b[i] = a[n-1-i*2];
    for(int i=n/2+1; i<n; ++i) b[i] = a[2*(i-n/2)-1];
  }
  else{
    REP(i, n/2) b[i] = a[n-1-i*2];
    for(int i=n/2; i<n; ++i) b[i] = a[2*(i-n/2)];
  }

  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 973 Byte
Status AC
Exec Time 127 ms
Memory 3712 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 125 ms 3712 KB
even_1.txt AC 126 ms 3712 KB
even_2.txt AC 126 ms 3712 KB
even_3.txt AC 127 ms 3712 KB
odd_0.txt AC 124 ms 3712 KB
odd_1.txt AC 124 ms 3712 KB
odd_2.txt AC 125 ms 3712 KB
odd_3.txt AC 127 ms 3712 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