結果

問題 No.360 増加門松列
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-04-20 13:04:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 780 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-15 03:53:17
合計ジャッジ時間 1,450 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 29 ms
10,880 KB
testcase_03 AC 31 ms
10,880 KB
testcase_04 WA -
testcase_05 AC 38 ms
10,880 KB
testcase_06 WA -
testcase_07 AC 36 ms
10,880 KB
testcase_08 WA -
testcase_09 AC 35 ms
11,008 KB
testcase_10 AC 26 ms
10,752 KB
testcase_11 AC 27 ms
10,880 KB
testcase_12 WA -
testcase_13 AC 30 ms
10,880 KB
testcase_14 AC 29 ms
10,880 KB
testcase_15 AC 34 ms
10,880 KB
testcase_16 AC 29 ms
10,880 KB
testcase_17 AC 30 ms
10,752 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 39 ms
10,752 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
import itertools


def is_inc_kado_seq(seq):
    cond0 = len(seq) == 3
    cond1 = len(set(seq)) == 3
    cond2 = seq[1] == max(seq) or seq[1] == min(seq)
    return cond0 and cond1 and cond2


def is_inc_kado_seq_seq(seq):
    n = len(seq)
    for i in range(n - 2):
        if not is_inc_kado_seq(seq[i: i + 3]):
            return False
    else:
        return True


def can_create_inc_kado_seq_seq(seq):
    for cand in itertools.permutations(seq):
        if is_inc_kado_seq_seq(cand):
            return True
    else:
        return False


def main():
    seq = array.array("B", map(int, input().split()))
    print("YES" if can_create_inc_kado_seq_seq(seq) else "NO")


if __name__ == '__main__':
    main()
0