Submeter | Todas submissőes | Melhores | Voltar |
Problem hidden
STACKEZ - Easy Stack |
You have an empty stack and you are given some queries. These queries are the basic stack operations such as Push, Pop, and printing the Top element. Now, you should process the given queries.
Input
First line contains an integer T (0 <= T <= 106).
Each of the next T lines contains a query based on these formats.
1 n : Push n (0 < n <= 109) to the top of the stack.
2 : Pop an element from the top of the stack. If the stack is empty, do nothing.
3 : Print the top element of the stack (see Output Format).
Output
For each query 3, print the top element of the stack. If the stack is empty, print 'Empty!' without quotes.
Example
Input: 6
1 15
1 20
2
3
2
3 Output: 15
Empty!
Warning!
Enormous input data!
Adicionado por: | Lucas |
Data: | 2017-02-15 |
Tempo limite: | 0.5s |
Tamanho do fonte: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Linguagem permitida: | Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL |