結果
問題 |
No.2804 Fixer And Ratism
|
ユーザー |
|
提出日時 | 2024-07-01 14:49:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,256 ms / 2,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 77,512 KB |
最終ジャッジ日時 | 2024-07-11 23:10:13 |
合計ジャッジ時間 | 14,383 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
N,Q=map(int,input().split()) there=[] for _ in range(Q): t,*q=input().split() if t=="1": there.append((int(q[1]),q[0])) elif t=="2": N-=int(q[0]) else: N+=int(q[1]) for i in range(len(there)): if there[i][1]==q[0]: there[i]=(there[i][0]%998244353+998244353,q[0]) there.sort(reverse=True) goodbye=[] while len(there)>N: goodbye.append((there[-1][0]%998244353,there[-1][1])) there.pop() goodbye.sort() for i in goodbye: print(i[1])