結果
| 問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-19 22:29:50 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 394 ms / 2,000 ms |
| コード長 | 974 bytes |
| 記録 | |
| コンパイル時間 | 304 ms |
| コンパイル使用メモリ | 84,864 KB |
| 実行使用メモリ | 144,128 KB |
| 最終ジャッジ日時 | 2026-05-27 20:52:27 |
| 合計ジャッジ時間 | 20,566 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 46 |
ソースコード
def solve():
n,m = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
sA = set(A)
sB = set(B)
sames = []
for b in B:
if b in sA:
sames.append(b)
if n == 0 or m == 0:
print("Yes")
for a in A:
print(f"Red {a}")
for b in B:
print(f"Blue {b}")
return
if sames == []:
print("No")
return
print("Yes")
for a in A:
if a not in sB:
print(f"Red {a}")
l = sames.pop()
print(f"Red {l}")
print(f"Blue {l}")
for b in B:
if b not in sA:
print(f"Blue {b}")
for i,l in enumerate(sames):
if i%2:
print(f"Red {l}")
print(f"Blue {l}")
else:
print(f"Blue {l}")
print(f"Red {l}")
return
t = int(input())
for _ in range(t):
solve()