結果
| 問題 | 
                            No.2307 [Cherry 5 th Tune *] Cool 46
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ntuda
                         | 
                    
| 提出日時 | 2023-05-20 11:35:49 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 558 ms / 2,000 ms | 
| コード長 | 719 bytes | 
| コンパイル時間 | 321 ms | 
| コンパイル使用メモリ | 82,556 KB | 
| 実行使用メモリ | 148,976 KB | 
| 最終ジャッジ日時 | 2024-12-21 10:03:45 | 
| 合計ジャッジ時間 | 28,882 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 46 | 
ソースコード
T = int(input())
for t in range(T):
    N,M = map(int,input().split())
    A = set(map(int,input().split()))
    B = set(map(int,input().split()))
    CO = A & B
    AO = A - CO
    BO = B - CO
    NC = len(CO)
    NA = len(AO)
    NB = len(BO)
    if NC == 0 and NA * NB > 0:
        print("No")
        continue
    print("Yes")
    for i in AO:
        print("Red",i)
    if NC > 0:
        i = next(iter(CO))
        print("Red", i)
        print("Blue", i)
        CO.remove(i)
    for i in BO:
        print("Blue",i)
    st = 1
    for i in CO:
        if st == 0:
            print("Red",i)
            print("Blue",i)
        else:
            print("Blue",i)
            print("Red",i)
        st ^= 1
            
            
            
        
            
ntuda