結果

問題 No.714 回転寿司屋のシミュレート
ユーザー lloyz
提出日時 2022-06-20 23:26:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 128 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-13 12:27:33
合計ジャッジ時間 2,303 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input())
Cnt = defaultdict(lambda :[0 for _ in range(21)])
for _ in range(n):
    L = list(input().split())
    if L[0] == '0':
        j = int(L[1])
        m = int(L[2])
        L = L[3:]
        for i in range(m):
            Cnt[L[i]][j] += 1
    elif L[0] == '1':
        s = L[1]
        flag = False
        for i in range(1, 21):
            if Cnt[s][i] > 0:
                Cnt[s][i] -= 1
                print(i)
                flag = True
                break
        if not flag:
            print(-1)
    elif L[0] == '2':
        j = int(L[1])
        for s in Cnt.keys():
            Cnt[s][j] = 0
0