結果

問題 No.360 増加門松列
ユーザー fumofumofunifumofumofuni
提出日時 2021-09-14 02:45:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 78,316 KB
最終ジャッジ日時 2023-09-08 11:47:40
合計ジャッジ時間 4,718 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
77,956 KB
testcase_01 AC 129 ms
78,128 KB
testcase_02 AC 129 ms
78,176 KB
testcase_03 AC 127 ms
77,840 KB
testcase_04 AC 130 ms
77,908 KB
testcase_05 AC 123 ms
77,728 KB
testcase_06 AC 130 ms
78,060 KB
testcase_07 AC 124 ms
77,624 KB
testcase_08 AC 130 ms
78,144 KB
testcase_09 AC 129 ms
78,076 KB
testcase_10 AC 119 ms
77,936 KB
testcase_11 AC 122 ms
78,112 KB
testcase_12 AC 132 ms
77,864 KB
testcase_13 AC 121 ms
77,892 KB
testcase_14 AC 118 ms
78,116 KB
testcase_15 AC 87 ms
76,448 KB
testcase_16 AC 120 ms
78,052 KB
testcase_17 AC 149 ms
78,248 KB
testcase_18 AC 136 ms
78,000 KB
testcase_19 AC 129 ms
78,316 KB
testcase_20 AC 130 ms
78,096 KB
testcase_21 AC 130 ms
77,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
D=list(map(int,input().split()))
list.sort(D)
def isok(x):
    if x[0]==x[1] or x[1]==x[2] or x[0]==x[2]:
        return False
    if x[0]>x[1] and x[1]<x[2]:
        return True
    if x[0]<x[1] and x[1]>x[2]:
        return True
    return False
ans=False
pat=list(itertools.permutations(D))
for p in pat:
    ret=True
    for i in range(5):
        ret&=isok(p[i:i+3])
    for i in range(5):
        ret&=p[i]<p[i+2]
    ans|=ret
if ans:
    print('YES')
else:
    print('NO')
0