結果

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

ソースコード

diff #

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

def hantei(l):
    for p in range(5):
        if l[p] < l[p+1] > l[p+2] or l[p] > l[p+1] < l[p+2]:
            if l[p] < l[p+2]:
                continue
            else:
                return False
        else:
            return False
    return True

for retsu in itertools.permutations(D, 7):
    if hantei(list(retsu)):
        print("YES")
        exit()
print("NO")
0