結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-05-19 22:39:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 611 ms / 2,000 ms
コード長 965 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 86,568 KB
実行使用メモリ 144,408 KB
最終ジャッジ日時 2023-08-23 03:50:34
合計ジャッジ時間 34,396 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,092 KB
testcase_01 AC 78 ms
71,020 KB
testcase_02 AC 327 ms
81,476 KB
testcase_03 AC 197 ms
79,004 KB
testcase_04 AC 181 ms
78,564 KB
testcase_05 AC 183 ms
78,400 KB
testcase_06 AC 185 ms
79,708 KB
testcase_07 AC 175 ms
77,920 KB
testcase_08 AC 211 ms
97,596 KB
testcase_09 AC 196 ms
97,244 KB
testcase_10 AC 177 ms
102,824 KB
testcase_11 AC 213 ms
102,092 KB
testcase_12 AC 197 ms
106,276 KB
testcase_13 AC 233 ms
101,296 KB
testcase_14 AC 209 ms
103,136 KB
testcase_15 AC 184 ms
96,132 KB
testcase_16 AC 212 ms
93,028 KB
testcase_17 AC 235 ms
97,532 KB
testcase_18 AC 218 ms
117,540 KB
testcase_19 AC 265 ms
143,848 KB
testcase_20 AC 229 ms
135,288 KB
testcase_21 AC 267 ms
137,068 KB
testcase_22 AC 272 ms
114,204 KB
testcase_23 AC 255 ms
136,080 KB
testcase_24 AC 279 ms
120,364 KB
testcase_25 AC 263 ms
118,172 KB
testcase_26 AC 236 ms
133,424 KB
testcase_27 AC 250 ms
114,824 KB
testcase_28 AC 243 ms
131,880 KB
testcase_29 AC 232 ms
128,908 KB
testcase_30 AC 280 ms
134,428 KB
testcase_31 AC 223 ms
135,504 KB
testcase_32 AC 221 ms
135,516 KB
testcase_33 AC 222 ms
127,512 KB
testcase_34 AC 247 ms
130,604 KB
testcase_35 AC 291 ms
138,964 KB
testcase_36 AC 251 ms
133,796 KB
testcase_37 AC 244 ms
124,284 KB
testcase_38 AC 566 ms
78,936 KB
testcase_39 AC 611 ms
78,816 KB
testcase_40 AC 205 ms
77,704 KB
testcase_41 AC 230 ms
79,012 KB
testcase_42 AC 248 ms
144,408 KB
testcase_43 AC 248 ms
144,392 KB
testcase_44 AC 206 ms
131,272 KB
testcase_45 AC 207 ms
131,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n,m = map(int,input().split())

    A = list(map(int,input().split()))
    B = list(map(int,input().split()))

    sA = set(A) & 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 sA:
            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()
0