Submission #3020032
Source Code Expand
import java.util.*; import java.lang.*; // class Pair implements Comparable<Pair>{ // long a; // int cnt; // public Pair(long i, int j){ // this.a = i; // this.cnt = j; // } // public int compareTo(Pair p){ // if(this.cnt>=2 && p.cnt >=2 && this.a<p.a) return -1; // if(this.cnt<2 && p.cnt>=2) return -1; // return 1; // } // } class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); if(N==1){ System.out.println(Long.parseLong(sc.next())); return; } LinkedList<Long> l = new LinkedList<>(); for(int i = 0; i<N; i++){ long a = Long.parseLong(sc.next()); if(i%2==0) l.push(a); else l.add(a); } if(N%2==1){ for(int i = 0; i<N-1; i++) System.out.print(l.get(i)+" "); System.out.println(l.get(N-1)); }else{ for(int i = 0; i<N-1; i++) System.out.print(l.get(N-1-i)+" "); System.out.println(l.get(0)); } } }
Submission Info
Submission Time | |
---|---|
Task | C - pushpush |
User | harunatsu |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1081 Byte |
Status | TLE |
Exec Time | 2109 ms |
Memory | 69024 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | TLE | 2105 ms | 69024 KB |
even_1.txt | TLE | 2109 ms | 65948 KB |
even_2.txt | TLE | 2109 ms | 66116 KB |
even_3.txt | TLE | 2109 ms | 63800 KB |
odd_0.txt | TLE | 2105 ms | 66304 KB |
odd_1.txt | TLE | 2109 ms | 67744 KB |
odd_2.txt | TLE | 2109 ms | 67208 KB |
odd_3.txt | TLE | 2109 ms | 67120 KB |
sample1.txt | AC | 89 ms | 20564 KB |
sample2.txt | AC | 89 ms | 19796 KB |
sample3.txt | AC | 88 ms | 19156 KB |
sample4.txt | AC | 89 ms | 20564 KB |