Created
July 2, 2020 20:02
-
-
Save ealexisaraujo/2e4a4827f2c80160d8779f87d4bbcf75 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stack = [] | |
M = [] | |
for _ in range(int(input())): | |
d = [int(x) for x in input().split()] | |
if d[0] == 1: | |
stack.append(d[1]) | |
M.append(max(d[1], M[-1]) | |
if M else d[1]) | |
elif d[0] == 2: | |
stack.pop() | |
M.pop() | |
elif d[0] == 3: | |
print(M[-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment