結果

問題 No.360 増加門松列
ユーザー HachimoriHachimori
提出日時 2016-04-17 22:56:26
言語 Python2
(2.7.18)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 671 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 6,160 KB
最終ジャッジ日時 2023-08-25 18:34:31
合計ジャッジ時間 1,454 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
6,116 KB
testcase_01 AC 19 ms
6,036 KB
testcase_02 AC 12 ms
5,960 KB
testcase_03 AC 11 ms
6,080 KB
testcase_04 AC 18 ms
5,988 KB
testcase_05 AC 16 ms
6,124 KB
testcase_06 AC 17 ms
6,160 KB
testcase_07 AC 17 ms
6,124 KB
testcase_08 AC 17 ms
5,984 KB
testcase_09 AC 17 ms
6,160 KB
testcase_10 AC 13 ms
6,096 KB
testcase_11 AC 11 ms
5,964 KB
testcase_12 AC 18 ms
5,964 KB
testcase_13 AC 12 ms
5,988 KB
testcase_14 AC 12 ms
6,060 KB
testcase_15 AC 15 ms
5,964 KB
testcase_16 AC 11 ms
6,116 KB
testcase_17 AC 12 ms
5,988 KB
testcase_18 AC 18 ms
6,032 KB
testcase_19 AC 18 ms
6,084 KB
testcase_20 AC 16 ms
6,144 KB
testcase_21 AC 17 ms
6,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import itertools


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


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


def work(vList):

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

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

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

0