結果

問題 No.360 増加門松列
ユーザー Navier_Boltzmann
提出日時 2022-02-26 19:54:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-04 16:25:58
合計ジャッジ時間 1,849 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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