Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stack = []
- def delete():
- stack.pop()
- def print_max():
- max_value = max(stack)
- print(*max_value)
- def print_min():
- min_value = min(stack)
- print(*min_value)
- commands = {
- '2': delete,
- '3': print_max,
- '4': print_min
- }
- # N = int(input())
- # for _ in range(N):
- # query = input().split()
- # command = query[0]
- # if command == '1':
- # number = int(query[1])
- # commands[command](number)
- # else:
- # commands[command]()
- N = int(input())
- for _ in range(N):
- command, *numbers = input().split()
- if command == '1':
- number = [int(num) for num in numbers]
- stack.append(number)
- else:
- if stack:
- commands[command]()
- reversed_stack = reversed(stack)
- print(', '.join(str(*item) for item in reversed_stack))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement