結果

問題 No.714 回転寿司屋のシミュレート
ユーザー GrayCoderGrayCoder
提出日時 2018-07-14 06:39:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 683 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-10-09 05:57:54
合計ジャッジ時間 2,266 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque, defaultdict
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    N = int(input())
    U = [tuple(input().split()) for _ in [0] * N]

    sushi = defaultdict(deque)
    kaikei = []
    for s in U:
        if s[0] == '0':
            for t in s[3:]:
                sushi[t].append(s[1])
        elif s[0] == '1':
            while sushi[s[1]]:
                seat = sushi[s[1]].popleft()
                if seat not in kaikei:
                    print(seat)
                    break
            else:
                print(-1)
        elif s[0] == '2':
            kaikei.append(s[1])

main()
0