Submission #1687478


Source Code Expand

#include<bits/stdc++.h>
using namespace std;  
#define rep(i,n) for(int i=0;i<(n);i++)  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LINF = (LLONG_MAX/2);
const double eps = 1e-14;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cout<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV 1000000007

int main(){
  int n; cin >> n;
  vi table(n);
  vi ans;
  rep(i,n)  cin >> table[i];
  for(int j = n-1; j > 0; j -= 2)
    ans.pb(table[j]);
  
  if(n%2 == 1)
    ans.pb(table[0]);
  for(int j = n%2; j < n; j += 2)
    ans.pb(table[j]);
  for(int i = 0; i < n; i++){
    cout << ans[i];
    if(i != n-1)
      cout << " ";
    else
      cout << endl;
  }
  return 0;
}

Submission Info

Submission Time
Task C - pushpush
User cashisu1
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1053 Byte
Status AC
Exec Time 100 ms
Memory 3828 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 99 ms 3828 KB
even_1.txt AC 100 ms 3828 KB
even_2.txt AC 100 ms 3828 KB
even_3.txt AC 100 ms 3828 KB
odd_0.txt AC 100 ms 3828 KB
odd_1.txt AC 100 ms 3828 KB
odd_2.txt AC 100 ms 3828 KB
odd_3.txt AC 100 ms 3828 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