結果

問題 No.714 回転寿司屋のシミュレート
ユーザー mitsuomitsuo
提出日時 2018-08-20 14:41:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 1,044 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 8,836 KB
最終ジャッジ日時 2023-08-16 13:04:15
合計ジャッジ時間 2,972 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,744 KB
testcase_01 AC 15 ms
7,820 KB
testcase_02 AC 16 ms
7,864 KB
testcase_03 AC 16 ms
7,804 KB
testcase_04 AC 18 ms
7,884 KB
testcase_05 AC 21 ms
8,392 KB
testcase_06 AC 26 ms
8,412 KB
testcase_07 AC 32 ms
8,320 KB
testcase_08 AC 44 ms
8,836 KB
testcase_09 AC 24 ms
8,240 KB
testcase_10 AC 22 ms
8,476 KB
testcase_11 AC 25 ms
8,360 KB
testcase_12 AC 23 ms
8,396 KB
testcase_13 AC 24 ms
8,432 KB
testcase_14 AC 24 ms
8,188 KB
testcase_15 AC 23 ms
8,292 KB
testcase_16 AC 24 ms
8,232 KB
testcase_17 AC 22 ms
8,280 KB
testcase_18 AC 23 ms
8,192 KB
testcase_19 AC 24 ms
8,304 KB
testcase_20 AC 23 ms
8,360 KB
testcase_21 AC 23 ms
8,320 KB
testcase_22 AC 20 ms
8,192 KB
testcase_23 AC 19 ms
8,260 KB
testcase_24 AC 19 ms
8,264 KB
testcase_25 AC 19 ms
8,304 KB
testcase_26 AC 20 ms
8,248 KB
testcase_27 AC 18 ms
8,344 KB
testcase_28 AC 19 ms
8,248 KB
testcase_29 AC 20 ms
8,268 KB
testcase_30 AC 15 ms
7,788 KB
testcase_31 AC 15 ms
7,928 KB
testcase_32 AC 15 ms
7,924 KB
testcase_33 AC 15 ms
7,840 KB
testcase_34 AC 15 ms
7,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(N, lines):
    hopelist = {}
    result = []
    for seatn in range(1, 21):
        hopelist.setdefault(seatn, [])

    for l in lines:
        if l.startswith("0"):
            d = l.split(" ")
            seat = int(d[1])
            _ = int(d[2])
            hopelist[seat] = d[3:]
        elif l.startswith("1"):
            neta = l.split(" ")[1]
            found = False

            for seatn in range(1, 21):
                hopes = hopelist[seatn]
                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)])]
0