結果
| 問題 |
No.714 回転寿司屋のシミュレート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-07-31 10:00:10 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 958 bytes |
| コンパイル時間 | 90 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-09-19 16:31:44 |
| 合計ジャッジ時間 | 2,747 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
# coding: utf-8
def main():
N = int(input())
seats = [[] for _ in range(20)]
for _ in range(N):
seats, output = _next(seats)
if output:
print(output)
def _next(seats):
funcs = { '0': sit, '1': serve, '2': leave }
inputs = input().split(' ')
return funcs[inputs[0]](seats, *inputs[1:])
def serve(seats, sushi):
for i, s in enumerate(seats):
if _index(s, sushi) != -1:
seats[i] = remove(s, _index(s, sushi))
return seats, i+1
return seats, -1
def remove(l, i):
return list(map(lambda t: t[1], filter(lambda t: t[0] != i, enumerate(l))))
def _index(l, e):
if e in l:
return l.index(e)
else:
return -1
def sit(seats, i, *info):
i = int(i)
seats[i-1] = list(info[1:])
return seats, None
def leave(seats, i):
i = int(i)
seats[i-1] = []
return seats, None
if __name__ == '__main__':
main()