Submission #1391163


Source Code Expand

Copy
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
	int n;
	cin >> n;

	vector<int> a;
	inputVector(a, n);

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

	if (n % 2) {
		reverse(all(b));
	}

	rep(i, n) {
		cout << b[i];
		if (i < n - 1) cout << ' ';
	}
	cout << endl;

    return 0;
}

Submission Info

Submission Time
Task C - pushpush
User iwashi31
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1090 Byte
Status AC
Exec Time 106 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 100 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 106 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