結果

問題 No.714 回転寿司屋のシミュレート
コンテスト
ユーザー MJDigit
提出日時 2019-06-16 19:00:02
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 836 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 567 ms
コンパイル使用メモリ 20,576 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-05-18 13:17:58
合計ジャッジ時間 5,665 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# -*- 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