-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path49.py
More file actions
32 lines (24 loc) · 670 Bytes
/
49.py
File metadata and controls
32 lines (24 loc) · 670 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from queue import PriorityQueue
import sys
def FILE_IO():
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
def solve():
n = int(input())
pq = PriorityQueue()
pqr = PriorityQueue()
for _ in range(n):
line = input()
if line[0] == '1':
x = int(line.split()[1])
pq.put(x)
elif line[0] == '2':
x = int(line.split()[1])
pqr.put(x)
else:
while not pqr.empty() and pq.queue[0] == pqr.queue[0]:
pq.get()
pqr.get()
print(pq.queue[0])
# FILE_IO()
solve()