結果
| 問題 |
No.2307 [Cherry 5 th Tune *] Cool 46
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-19 22:29:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 640 ms / 2,000 ms |
| コード長 | 974 bytes |
| コンパイル時間 | 572 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 132,420 KB |
| 最終ジャッジ日時 | 2024-12-21 03:14:12 |
| 合計ジャッジ時間 | 33,010 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()