結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-05-19 22:43:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 323 ms / 2,000 ms
コード長 1,039 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 144,240 KB
最終ジャッジ日時 2023-08-23 03:51:09
合計ジャッジ時間 34,497 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
70,860 KB
testcase_01 AC 76 ms
71,152 KB
testcase_02 AC 266 ms
80,432 KB
testcase_03 AC 186 ms
78,652 KB
testcase_04 AC 170 ms
78,592 KB
testcase_05 AC 176 ms
78,304 KB
testcase_06 AC 176 ms
79,416 KB
testcase_07 AC 189 ms
77,732 KB
testcase_08 AC 216 ms
97,788 KB
testcase_09 AC 205 ms
97,148 KB
testcase_10 AC 189 ms
102,492 KB
testcase_11 AC 230 ms
101,992 KB
testcase_12 AC 212 ms
106,084 KB
testcase_13 AC 257 ms
101,020 KB
testcase_14 AC 211 ms
102,528 KB
testcase_15 AC 184 ms
95,916 KB
testcase_16 AC 207 ms
92,108 KB
testcase_17 AC 254 ms
97,464 KB
testcase_18 AC 212 ms
117,296 KB
testcase_19 AC 293 ms
143,888 KB
testcase_20 AC 243 ms
135,320 KB
testcase_21 AC 268 ms
137,128 KB
testcase_22 AC 223 ms
113,868 KB
testcase_23 AC 266 ms
135,828 KB
testcase_24 AC 259 ms
120,280 KB
testcase_25 AC 246 ms
117,828 KB
testcase_26 AC 234 ms
133,372 KB
testcase_27 AC 253 ms
114,520 KB
testcase_28 AC 267 ms
131,644 KB
testcase_29 AC 252 ms
128,600 KB
testcase_30 AC 313 ms
134,256 KB
testcase_31 AC 228 ms
135,156 KB
testcase_32 AC 231 ms
135,140 KB
testcase_33 AC 221 ms
127,164 KB
testcase_34 AC 262 ms
130,280 KB
testcase_35 AC 292 ms
138,800 KB
testcase_36 AC 269 ms
134,184 KB
testcase_37 AC 262 ms
123,908 KB
testcase_38 AC 272 ms
78,244 KB
testcase_39 AC 323 ms
79,404 KB
testcase_40 AC 191 ms
77,320 KB
testcase_41 AC 234 ms
78,292 KB
testcase_42 AC 275 ms
144,224 KB
testcase_43 AC 270 ms
144,240 KB
testcase_44 AC 227 ms
131,056 KB
testcase_45 AC 220 ms
131,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
def solve():
    n,m = mi()

    A = li()
    B = li()

    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