結果
| 問題 | No.2804 Fixer And Ratism | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-07-01 14:48:02 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 539 bytes | 
| コンパイル時間 | 150 ms | 
| コンパイル使用メモリ | 82,572 KB | 
| 実行使用メモリ | 77,656 KB | 
| 最終ジャッジ日時 | 2024-07-11 23:10:26 | 
| 合計ジャッジ時間 | 15,338 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 13 WA * 18 | 
ソースコード
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,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])
            
            
            
        