結果
問題 |
No.2307 [Cherry 5 th Tune *] Cool 46
|
ユーザー |
|
提出日時 | 2023-05-20 14:18:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 364 ms / 2,000 ms |
コード長 | 722 bytes |
コンパイル時間 | 617 ms |
コンパイル使用メモリ | 82,464 KB |
実行使用メモリ | 157,336 KB |
最終ジャッジ日時 | 2024-12-21 11:17:07 |
合計ジャッジ時間 | 26,209 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 46 |
ソースコード
t = int(input()) color = ["Red", "Blue"] ans = [] for _ in range(t): n, m = map(int, input().split()) a = set(list(map(int, input().split()))) b = set(list(map(int, input().split()))) xs = a & b if len(a) > 0 and len(b) > 0 and len(xs) == 0: ans.append("No") continue a -= xs b -= xs xs = list(xs) ans.append("Yes") for x in b: ans.append(color[1] + " " + str(x)) if len(xs) > 0: x = xs.pop() ans.append(color[1] + " " + str(x)) ans.append(color[0] + " " + str(x)) for x in a: ans.append(color[0] + " " + str(x)) for i in range(len(xs)): ans.append(color[i % 2] + " " + str(xs[i])) ans.append(color[1 - i % 2] + " " + str(xs[i])) print(*ans, sep="\n")