結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー |
![]() |
提出日時 | 2018-07-29 09:35:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 1,383 bytes |
コンパイル時間 | 76 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-08 08:31:48 |
合計ジャッジ時間 | 2,468 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
# 0を受け取った時の処理 def come_customer(sushiya:list, table:int, kuitai:list) -> None: if len(sushiya[table]) == 0: sushiya[table].append(kuitai) else: raise ValueError("すでに客がいます") # 1を受け取った時の処理 def offer_sushi(sushiya:list, neta:str) -> None: for table in range(20): # 客がいなければスルー if len(sushiya[table]) == 0: continue # 客がいれば食いたいリストを探索。とった人の番号を出力 else: if neta in sushiya[table][0]: sushiya[table][0].remove(neta) print(table+1) return # 誰もとらなければ-1 print(-1) # 2を受け取った時の処理 def go_customer(sushiya:list, table:int): sushiya[table].clear() # 寿司屋の初期化 sushiya = [[] for _ in range(20)] N = int(input()) # クエリを順次受け取る for i in range(N): data = list(input().split()) if data[0] == "0": table = int(data[1]) cap = int(data[2]) kuitai = data[3:] come_customer(sushiya, table-1, kuitai) elif data[0] == "1": neta = data[1] offer_sushi(sushiya, neta) elif data[0] == "2": table = int(data[1]) go_customer(sushiya,table-1)