結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
70,628 KB
testcase_01 AC 74 ms
70,828 KB
testcase_02 AC 304 ms
81,124 KB
testcase_03 AC 191 ms
79,120 KB
testcase_04 AC 171 ms
78,856 KB
testcase_05 AC 177 ms
79,440 KB
testcase_06 AC 182 ms
80,220 KB
testcase_07 AC 168 ms
78,408 KB
testcase_08 AC 199 ms
95,756 KB
testcase_09 AC 190 ms
97,008 KB
testcase_10 AC 183 ms
104,872 KB
testcase_11 AC 205 ms
101,340 KB
testcase_12 AC 198 ms
107,012 KB
testcase_13 AC 235 ms
103,464 KB
testcase_14 AC 197 ms
102,684 KB
testcase_15 AC 177 ms
96,536 KB
testcase_16 AC 205 ms
93,108 KB
testcase_17 AC 230 ms
97,736 KB
testcase_18 AC 225 ms
117,592 KB
testcase_19 AC 241 ms
131,304 KB
testcase_20 AC 240 ms
135,552 KB
testcase_21 AC 249 ms
135,748 KB
testcase_22 AC 217 ms
114,024 KB
testcase_23 AC 244 ms
135,460 KB
testcase_24 AC 248 ms
115,428 KB
testcase_25 AC 246 ms
116,136 KB
testcase_26 AC 222 ms
133,404 KB
testcase_27 AC 245 ms
114,040 KB
testcase_28 AC 250 ms
131,000 KB
testcase_29 AC 241 ms
128,740 KB
testcase_30 AC 260 ms
124,296 KB
testcase_31 AC 226 ms
135,284 KB
testcase_32 AC 225 ms
135,600 KB
testcase_33 AC 217 ms
127,364 KB
testcase_34 AC 237 ms
128,516 KB
testcase_35 AC 260 ms
128,908 KB
testcase_36 AC 249 ms
130,748 KB
testcase_37 AC 252 ms
123,112 KB
testcase_38 AC 531 ms
78,616 KB
testcase_39 AC 608 ms
78,392 KB
testcase_40 AC 194 ms
77,560 KB
testcase_41 AC 225 ms
78,376 KB
testcase_42 AC 231 ms
129,968 KB
testcase_43 AC 230 ms
129,960 KB
testcase_44 AC 200 ms
131,200 KB
testcase_45 AC 207 ms
131,232 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)
    sB = 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 sB:
            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