Submission #3728079
Source Code Expand
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1e9; const int MOD = 1e9 + 7; ll dp[300010]; int main() { int n; cin >> n; list<int> a; if (n % 2 == 0) { for (int i = 0; i < n; ++i) { int t; cin >> t; if (i % 2 == 0) { a.push_back(t); } else { a.push_front(t); } } } else { for (int i = 0; i < n; ++i) { int t; cin >> t; if (i % 2 == 0) { a.push_front(t); } else { a.push_back(t); } } } cout << a.front(); for (auto itr = a.begin(); itr != a.end(); ++itr) { if (itr == a.begin()) continue; cout << ' ' << *itr; } cout << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - pushpush |
User | hideh_1231 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 830 Byte |
Status | AC |
Exec Time | 113 ms |
Memory | 8448 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 110 ms | 8448 KB |
even_1.txt | AC | 112 ms | 8448 KB |
even_2.txt | AC | 111 ms | 8448 KB |
even_3.txt | AC | 110 ms | 8448 KB |
odd_0.txt | AC | 113 ms | 8448 KB |
odd_1.txt | AC | 112 ms | 8448 KB |
odd_2.txt | AC | 113 ms | 8448 KB |
odd_3.txt | AC | 112 ms | 8448 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 |