結果
| 問題 |
No.1366 交換門松列・梅
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-01 11:48:12 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 1,000 ms |
| コード長 | 798 bytes |
| コンパイル時間 | 123 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,876 KB |
| 最終ジャッジ日時 | 2025-06-20 11:07:42 |
| 合計ジャッジ時間 | 1,209 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
from itertools import product
from typing import Sequence
def is_kadomatsu(numbers: Sequence[int]) -> bool:
assert len(numbers) == 3
if numbers[0] == numbers[2]:
return False
if numbers[0] < numbers[1] and numbers[1] > numbers[2]:
return True
if numbers[0] > numbers[1] and numbers[1] < numbers[2]:
return True
return False
def main():
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for idx1, idx2 in product(range(3), repeat=2):
a_copy = a[:]
b_copy = b[:]
a_copy[idx1], b_copy[idx2] = b_copy[idx2], a_copy[idx1]
if is_kadomatsu(a_copy) and is_kadomatsu(b_copy):
print("Yes")
return
else:
print("No")
if __name__ == "__main__":
main()