結果

問題 No.632 穴埋め門松列
ユーザー ThetaTheta
提出日時 2022-11-01 13:15:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 657 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 9,832 KB
最終ジャッジ日時 2023-09-23 06:35:13
合計ジャッジ時間 1,022 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
9,720 KB
testcase_01 AC 31 ms
9,648 KB
testcase_02 AC 31 ms
9,712 KB
testcase_03 AC 31 ms
9,744 KB
testcase_04 AC 31 ms
9,832 KB
testcase_05 AC 32 ms
9,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from typing import Sequence


def is_kadomatsu(height_seq: Sequence[int]) -> bool:
    if len(set(height_seq)) != 3:
        return False

    if max(height_seq) == height_seq[1] or min(height_seq) == height_seq[1]:
        return True
    return False

def main():
    c = list(input().split())
    question_idx = c.index("?")
    c_1 = c.copy()
    c_1[question_idx] = 1
    c_2 = c.copy()
    c_2[question_idx] = 4
    c_1 = list(map(int, c_1))
    c_2 = list(map(int, c_2))

    if is_kadomatsu(c_1):
        if is_kadomatsu(c_2):
            print(14)
        else:
            print(1)
    else:
        print(4)

if __name__ == "__main__":
    main()
0