結果
問題 | No.2804 Fixer And Ratism |
ユーザー |
|
提出日時 | 2025-02-12 14:36:22 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 618 bytes |
コンパイル時間 | 1,115 ms |
コンパイル使用メモリ | 82,248 KB |
実行使用メモリ | 67,112 KB |
最終ジャッジ日時 | 2025-02-12 14:36:28 |
合計ジャッジ時間 | 5,810 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 31 |
ソースコード
from sortedcontainers import SortedSetfrom collections import defaultdictn,q=map(int,input().split())Sr=SortedSet([])Sn=SortedSet([])D=defaultdict(int)for _ in range(q):A=input().split()if A[0]=="1":s=A[1]r=int(A[2])D[s]=rSn.add((r,s))elif A[0]=="2":x=int(A[1])n-=xelse:s = A[1]x = int(A[2])n+=xSr.add((D[s],s))Sn.discard((D[s],s))while len(Sn)+len(Sr)>n:if len(Sn)>0:r,s=Sn.pop(0)print(s)else:r, s = Sr.pop(0)print(s)