結果

問題 No.360 増加門松列
コンテスト
ユーザー norioc
提出日時 2026-01-07 02:36:00
言語 PyPy3
(7.3.17)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 453 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 387 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 71,480 KB
最終ジャッジ日時 2026-01-07 02:36:03
合計ジャッジ時間 2,710 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import permutations


def is_kadomatu(a, b, c):
    if a == c: return False
    return (a < b > c) or (a > b < c)


def solve():
    for xs in permutations(DD):
        for i in range(5):
            a, b, c = xs[i:i+3]
            if not is_kadomatu(a, b, c) or a > c:
                break
        else:
            return True

    return False


DD = list(map(int, input().split()))
if solve():
    print('YES')
else:
    print('NO')
0