Submission #1689982


Source Code Expand

#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <string>
#include <utility>
#include <cstdio>
#include <cmath>
#include <deque>

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define X first
#define Y second

using ll = long long;
using namespace std;
using vi = vector<int>;
using pii = pair<int, int>;

constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vi a(n + 1);
	REP1(i, n) cin >> a[i];
	deque<int> b;
	int amr = n  % 2;
	REP1(i, n) {
		if (i % 2 == amr) b.push_front(a[i]);
		else b.push_back(a[i]);
	}
	cout << b.front(); b.pop_front();
	while (!b.empty()) {
		cout << " " << b.front();
		b.pop_front();
	}
	cout << "\n";
	return 0;
}

Submission Info

Submission Time
Task C - pushpush
User hagyu_aya
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1073 Byte
Status AC
Exec Time 39 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 39 ms 3840 KB
even_1.txt AC 38 ms 3840 KB
even_2.txt AC 39 ms 3840 KB
even_3.txt AC 38 ms 3840 KB
odd_0.txt AC 38 ms 3840 KB
odd_1.txt AC 39 ms 3840 KB
odd_2.txt AC 38 ms 3840 KB
odd_3.txt AC 38 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