結果

問題 No.714 回転寿司屋のシミュレート
ユーザー aporo_eeicaporo_eeic
提出日時 2018-07-13 23:03:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-09 05:29:53
合計ジャッジ時間 2,457 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections

customers = [collections.Counter() for i in range(21)]

def set_costomer(row):
    customers[int(row[0])] = collections.Counter()
    for neta in row[2:]:
        customers[int(row[0])][neta] += 1

def remove_customer(row):
    customers[int(row[0])] = collections.Counter()

def roling_neta(neta):
    for i in range(1,21):
        if(customers[i][neta[0]] > 0):
            customers[i][neta[0]] -= 1
            return i
    return -1 

N = int(input().strip())
for n in range(N):
    row = list(input().strip().split(" "))
    if(int(row[0]) == 0):
        set_costomer(row[1:])
    if(int(row[0]) == 1):
        eaten_by = roling_neta(row[1:])
        print(eaten_by)
    if(int(row[0]) == 2):
        remove_customer(row[1:])
0