結果

問題 No.360 増加門松列
コンテスト
ユーザー Navier_Boltzmann
提出日時 2022-02-26 19:54:23
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 480 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 358 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 15,360 KB
最終ジャッジ日時 2026-03-26 00:13:57
合計ジャッジ時間 3,457 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

D = list(map(int,input().split()))

from itertools import permutations


def is_ok(X):
    for i in range(1,6):
        T = X[i-1:i+2]
        if len(set(T)) !=3:
            return False
        if (T[1]==min(T) or T[1] == max(T)) and T[0]<T[2]:
            continue
        else:
            return False
    return True

for p in permutations([i for i in range(7)]):
    
    P = [D[p[i]] for i in range(7)]
    
    if is_ok(P):
        print("YES")
        exit()
print("NO")
0