結果

問題 No.360 増加門松列
ユーザー HachimoriHachimori
提出日時 2016-04-17 22:54:36
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-04 10:44:21
合計ジャッジ時間 1,088 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
#coding:utf8

import itertools


def read():
    return map(int, raw_input().split())


def isKadomatsu(A1, A2, A3):
    return len(set([A1, A2, A3])) == 3 and (A2 > max(A1, A3) or A2 < min(A1, A3))


def work(vList):

    for candi in itertools.permutations(vList, len(vList)):
        isOK = True
        for i in range(len(vList) - 2):
            if not isKadomatsu(candi[i], candi[i + 1], candi[i + 2]):
                isOK = False
                break

        if isOK:
            print "YES"
            return
    
    print "NO"

    
if __name__ == "__main__":
    work(read())
0