diff --git "a/\352\260\225\355\230\204\354\232\261/11286.py" "b/\352\260\225\355\230\204\354\232\261/11286.py" new file mode 100644 index 00000000..687e3fe2 --- /dev/null +++ "b/\352\260\225\355\230\204\354\232\261/11286.py" @@ -0,0 +1,17 @@ +import sys +import heapq +input = sys.stdin.readline + +ls=[] +count = int(input()) +for j in range(count): + num=int(input()) + if num>0: + heapq.heappush(ls, (num,num)) + elif num==0: + if len(ls)==0: + print(0) + else: + print(heapq.heappop(ls)[1]) + else: + heapq.heappush(ls, (-num,num)) \ No newline at end of file