結果
問題 |
No.714 回転寿司屋のシミュレート
|
ユーザー |
|
提出日時 | 2018-08-20 14:29:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 953 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-11-25 01:17:34 |
合計ジャッジ時間 | 2,784 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 31 |
ソースコード
def solve(N, lines): hopelist = {} result = [] for l in lines[1:]: if l.startswith("0"): d = l.split(" ") seat = int(d[1]) _ = int(d[2]) hopelist[seat] = d[3:] if l.startswith("1"): neta = l.split(" ")[1] found = False for seatn, hopes in sorted(hopelist.items()): for i, h in enumerate(hopes): if h == neta: hopes.pop(i) result.append(seatn) found = True break if found: break if not found: result.append(-1) elif l.startswith("2"): seat = int(l.split(" ")[1]) hopelist[seat] = [] return result if __name__ == "__main__": N = int(input()) [print(s) for s in solve(N, [input() for _ in range(N)])]