結果

問題 No.714 回転寿司屋のシミュレート
ユーザー MJDigit
提出日時 2019-06-16 19:00:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 836 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-24 12:57:19
合計ジャッジ時間 2,399 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

orderlist = {}
NUM_TABLES = 20

pos_to_index = lambda p: int(p)-1
index_to_pos = lambda i: i+1

def add_new_customer(pos, numsushis, sushis):
    orderlist[pos_to_index(pos)] = sushis.split()

def remove_customer(pos):
    orderlist[pos_to_index(pos)] = None

def serve_sushi(sushi):
    for i in range(NUM_TABLES):
        if orderlist[i] and sushi in orderlist[i]:
            orderlist[i].remove(sushi)
            print(index_to_pos(i))
            return
    print(-1)

# initialize order list
for i in range(NUM_TABLES):
    orderlist[i] = None

numdata = int(input())
for i in range (numdata):
    datatype, data = input().split(" ", 1)
    if int(datatype) == 0:
        add_new_customer(*data.split(" ", 2))
    elif int(datatype) == 1:
        serve_sushi(data)
    else:
        remove_customer(data)
0