結果
問題 |
No.2307 [Cherry 5 th Tune *] Cool 46
|
ユーザー |
|
提出日時 | 2023-05-19 23:39:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 548 ms / 2,000 ms |
コード長 | 1,456 bytes |
コンパイル時間 | 331 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 144,540 KB |
最終ジャッジ日時 | 2024-12-21 04:03:11 |
合計ジャッジ時間 | 35,225 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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): try: 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") continue print("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") except: print("No")