結果

問題 No.714 回転寿司屋のシミュレート
ユーザー ntuda
提出日時 2025-01-12 15:36:28
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 685 bytes
コンパイル時間 2,349 ms
コンパイル使用メモリ 82,476 KB
実行使用メモリ 65,280 KB
最終ジャッジ日時 2025-01-12 15:36:34
合計ジャッジ時間 6,281 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

from sortedcontainers import SortedList
from collections import defaultdict
removed = set()
dic = defaultdict(SortedList)
for _ in range(int(input())):
    t, *dat = list(input().split())
    t = int(t)
    if t == 0:
        seat, n, *dishes = dat
        seat = int(seat)
        for d in dishes:
            dic[d].add(seat)
    elif t == 1:
        d = dat[0]
        if d in dic:
            while dic[d] and dic[d][0] in removed:
                x = dic[d].pop(0)
            if dic[d]:
                x = dic[d].pop(0)
                print(x)
            if not dic[d]:
                dic.pop(d)
        else:
            print(-1)
    else:
        removed.add(int(dat[0]))
0