Submission #3048162


Source Code Expand


#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

using namespace std;

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

	vector<int> a(n, 0);

	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}

	if (n == 1) {
		cout << a[0] << endl;
		return 0;
	}

	int index = n-1;
	
	while (true) {
			cout << a[index];

			index -= 2;

			cout << " ";

			if (index < 0) {
				break;
			}

		
	}

	if (n % 2 == 0) {
		index = 0;
	}
	else {
		index = 1;
	}
	

	while (true) {
		cout << a[index];

		index += 2;
		if (index > n-1) {
			break;
		}

		cout << " ";
	}

	cout << endl;

	
}

Submission Info

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