結果

問題 No.360 増加門松列
ユーザー 👑 Kazun
提出日時 2021-02-10 23:25:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 358 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-07-08 10:40:17
合計ジャッジ時間 2,554 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

from itertools import permutations
D=list(map(int,input().split()))
N=7

F=0
for t in permutations(D):
    G=1
    for i in range(5):
        if not (is_kaimatsu(t[i],t[i+1],t[i+2]) and t[i]<t[i+2]):
            G=0
    F|=G

print("YES" if F else "NO")
0