結果

問題 No.360 増加門松列
ユーザー nanaenanae
提出日時 2017-02-10 11:34:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 801 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 8,332 KB
最終ジャッジ日時 2023-08-25 18:41:41
合計ジャッジ時間 1,409 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,192 KB
testcase_01 AC 19 ms
8,156 KB
testcase_02 AC 18 ms
8,156 KB
testcase_03 AC 16 ms
8,164 KB
testcase_04 AC 18 ms
8,148 KB
testcase_05 AC 18 ms
8,120 KB
testcase_06 AC 18 ms
8,284 KB
testcase_07 AC 18 ms
8,148 KB
testcase_08 AC 18 ms
8,224 KB
testcase_09 AC 18 ms
8,304 KB
testcase_10 AC 17 ms
8,188 KB
testcase_11 AC 15 ms
8,196 KB
testcase_12 AC 18 ms
8,332 KB
testcase_13 AC 16 ms
8,116 KB
testcase_14 AC 16 ms
8,116 KB
testcase_15 AC 18 ms
8,164 KB
testcase_16 AC 17 ms
8,292 KB
testcase_17 AC 16 ms
8,152 KB
testcase_18 AC 18 ms
8,148 KB
testcase_19 AC 18 ms
8,192 KB
testcase_20 AC 18 ms
8,228 KB
testcase_21 AC 18 ms
8,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import permutations

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def is_kadomatu(a):
    return a[0] != a[2] and (a[0] - a[1])*(a[2] - a[1]) > 0

def solve():
    Ds = [int(i) for i in input().split()]

    for line in permutations(Ds):
        for i in range(7 - 2):
            if not is_kadomatu((line[i], line[i + 1], line[i + 2])):
                break
            elif not(line[0] < line[2] < line[4] < line[6]
                     and line[1] < line[3] < line[5]):
                break
        else:
            print('YES')
            # debug(line, locals())
            return

    print('NO')

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