結果

問題 No.632 穴埋め門松列
コンテスト
ユーザー Theta
提出日時 2022-11-01 13:15:31
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 122 ms / 1,000 ms
コード長 657 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 763 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 19,676 KB
最終ジャッジ日時 2026-03-30 20:19:36
合計ジャッジ時間 1,845 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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