結果

問題 No.1366 交換門松列・梅
ユーザー hiragnhiragn
提出日時 2022-11-07 18:16:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 1,000 ms
コード長 481 bytes
コンパイル時間 905 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 8,304 KB
最終ジャッジ日時 2023-09-28 07:10:36
合計ジャッジ時間 1,331 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,128 KB
testcase_01 AC 15 ms
8,152 KB
testcase_02 AC 15 ms
8,248 KB
testcase_03 AC 16 ms
8,184 KB
testcase_04 AC 16 ms
8,152 KB
testcase_05 AC 16 ms
8,148 KB
testcase_06 AC 16 ms
8,144 KB
testcase_07 AC 16 ms
8,296 KB
testcase_08 AC 16 ms
8,180 KB
testcase_09 AC 15 ms
8,124 KB
testcase_10 AC 17 ms
8,132 KB
testcase_11 AC 16 ms
8,292 KB
testcase_12 AC 16 ms
8,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools


def is_kadomatsu(lst):
    return len(set(lst)) == 3 and (lst[1] == max(lst) or lst[1] == min(lst))


def main():
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    for i, j in itertools.product(range(3), repeat=2):
        a[i], b[j] = b[j], a[i]
        if is_kadomatsu(a) and is_kadomatsu(b):
            print("Yes")
            return
        a[i], b[j] = b[j], a[i]
    print("No")


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