結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-05-19 22:43:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 1,039 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 141,172 KB
最終ジャッジ日時 2024-06-01 01:31:38
合計ジャッジ時間 28,455 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,264 KB
testcase_01 AC 42 ms
52,480 KB
testcase_02 AC 244 ms
78,156 KB
testcase_03 AC 166 ms
78,720 KB
testcase_04 AC 147 ms
77,756 KB
testcase_05 AC 149 ms
78,232 KB
testcase_06 AC 150 ms
78,860 KB
testcase_07 AC 140 ms
77,448 KB
testcase_08 AC 166 ms
95,944 KB
testcase_09 AC 162 ms
97,372 KB
testcase_10 AC 138 ms
98,512 KB
testcase_11 AC 173 ms
102,468 KB
testcase_12 AC 161 ms
104,988 KB
testcase_13 AC 197 ms
98,304 KB
testcase_14 AC 168 ms
101,812 KB
testcase_15 AC 151 ms
100,172 KB
testcase_16 AC 176 ms
90,912 KB
testcase_17 AC 199 ms
97,892 KB
testcase_18 AC 175 ms
116,728 KB
testcase_19 AC 226 ms
140,204 KB
testcase_20 AC 200 ms
132,436 KB
testcase_21 AC 216 ms
133,804 KB
testcase_22 AC 177 ms
114,340 KB
testcase_23 AC 217 ms
132,980 KB
testcase_24 AC 217 ms
120,860 KB
testcase_25 AC 209 ms
119,100 KB
testcase_26 AC 187 ms
130,624 KB
testcase_27 AC 205 ms
115,320 KB
testcase_28 AC 222 ms
128,192 KB
testcase_29 AC 204 ms
125,608 KB
testcase_30 AC 231 ms
133,092 KB
testcase_31 AC 193 ms
132,396 KB
testcase_32 AC 189 ms
132,404 KB
testcase_33 AC 182 ms
107,272 KB
testcase_34 AC 205 ms
111,888 KB
testcase_35 AC 232 ms
136,220 KB
testcase_36 AC 223 ms
131,028 KB
testcase_37 AC 206 ms
122,140 KB
testcase_38 AC 215 ms
77,580 KB
testcase_39 AC 278 ms
78,400 KB
testcase_40 AC 148 ms
76,660 KB
testcase_41 AC 179 ms
77,044 KB
testcase_42 AC 212 ms
140,912 KB
testcase_43 AC 215 ms
141,172 KB
testcase_44 AC 170 ms
130,640 KB
testcase_45 AC 174 ms
130,404 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