結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー |
|
提出日時 | 2023-05-19 23:33:01 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 517 ms / 2,000 ms |
コード長 | 1,250 bytes |
コンパイル時間 | 365 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 144,548 KB |
最終ジャッジ日時 | 2024-12-21 04:07:13 |
合計ジャッジ時間 | 32,782 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 46 |
ソースコード
T = int(input())NN = []MM = []AA = []BB = []for _ in range(T):n, m = map(int, input().split())a = list(map(int, input().split()))b = list(map(int, input().split()))NN.append(n)MM.append(m)AA.append(a)BB.append(b)for i in range(T):N = NN[i]M = MM[i]A = AA[i]B = BB[i]if N>0 and M>0:setA = set(A)setB = set(B)same = []diff = []for b in B:if b in setA:same.append(b)else:diff.append(b)if len(same)==0:print("No")continueprint("Yes")for d in diff:print("Blue", d)for i, s in enumerate(same):if i%2==0:print("Blue", s)print("Red", s)if i==0:for a in setA:if a not in setB:print("Red", a)else:print("Red", s)print("Blue", s)elif N>0:print("Yes")for a in A:print("Red", a)elif M>0:print("Yes")for b in B:print("Blue", b)else:print("Yes")