結果

問題 No.360 増加門松列
ユーザー lloyzlloyz
提出日時 2023-10-17 00:18:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 657 bytes
コンパイル時間 2,602 ms
コンパイル使用メモリ 81,656 KB
実行使用メモリ 76,188 KB
最終ジャッジ日時 2023-10-17 00:19:10
合計ジャッジ時間 4,995 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
76,036 KB
testcase_01 AC 63 ms
75,880 KB
testcase_02 AC 41 ms
61,688 KB
testcase_03 AC 35 ms
53,612 KB
testcase_04 AC 65 ms
75,972 KB
testcase_05 AC 62 ms
75,864 KB
testcase_06 AC 73 ms
76,188 KB
testcase_07 AC 66 ms
75,864 KB
testcase_08 AC 71 ms
76,012 KB
testcase_09 AC 67 ms
75,924 KB
testcase_10 AC 50 ms
68,732 KB
testcase_11 AC 37 ms
59,568 KB
testcase_12 AC 81 ms
75,916 KB
testcase_13 AC 44 ms
63,888 KB
testcase_14 AC 43 ms
63,748 KB
testcase_15 AC 48 ms
70,724 KB
testcase_16 AC 35 ms
53,612 KB
testcase_17 AC 46 ms
63,888 KB
testcase_18 AC 66 ms
76,072 KB
testcase_19 AC 68 ms
76,032 KB
testcase_20 AC 88 ms
75,904 KB
testcase_21 AC 64 ms
75,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

def check_kadomatsu(A):
    is_kadomatsu = True
    for i in range(3):
        if A[i] == A[(i + 1) % 3]:
            is_kadomatsu = False
    if not (A[0] < A[1] > A[2] or A[0] > A[1] < A[2]):
        is_kadomatsu = False
    return is_kadomatsu

D = list(map(int, input().split()))
for P in permutations(range(7)):
    A = [D[P[i]] for i in range(7)]
    flag = True
    for i in range(5):
        B = A[i:i + 3]
        if not check_kadomatsu(B):
            flag = False
            break
        if B[0] > B[2]:
            flag = False
            break
    if flag:
        print("YES")
        exit()
print("NO")
0