結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー 👑 KazunKazun
提出日時 2023-02-17 04:27:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 304 ms / 2,000 ms
コード長 1,014 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 139,072 KB
最終ジャッジ日時 2023-08-23 02:17:32
合計ジャッジ時間 32,550 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,024 KB
testcase_01 AC 74 ms
71,432 KB
testcase_02 AC 282 ms
81,928 KB
testcase_03 AC 224 ms
80,864 KB
testcase_04 AC 199 ms
81,200 KB
testcase_05 AC 203 ms
81,220 KB
testcase_06 AC 208 ms
82,440 KB
testcase_07 AC 192 ms
81,832 KB
testcase_08 AC 223 ms
97,372 KB
testcase_09 AC 215 ms
96,740 KB
testcase_10 AC 201 ms
104,348 KB
testcase_11 AC 234 ms
101,452 KB
testcase_12 AC 211 ms
106,124 KB
testcase_13 AC 259 ms
102,932 KB
testcase_14 AC 217 ms
101,408 KB
testcase_15 AC 198 ms
100,252 KB
testcase_16 AC 234 ms
92,688 KB
testcase_17 AC 244 ms
97,128 KB
testcase_18 AC 241 ms
117,308 KB
testcase_19 AC 298 ms
138,820 KB
testcase_20 AC 254 ms
135,664 KB
testcase_21 AC 275 ms
137,220 KB
testcase_22 AC 240 ms
113,792 KB
testcase_23 AC 280 ms
136,220 KB
testcase_24 AC 272 ms
118,388 KB
testcase_25 AC 265 ms
117,508 KB
testcase_26 AC 247 ms
134,052 KB
testcase_27 AC 268 ms
114,656 KB
testcase_28 AC 270 ms
132,228 KB
testcase_29 AC 263 ms
129,548 KB
testcase_30 AC 284 ms
130,872 KB
testcase_31 AC 249 ms
135,468 KB
testcase_32 AC 252 ms
135,856 KB
testcase_33 AC 241 ms
127,872 KB
testcase_34 AC 276 ms
130,572 KB
testcase_35 AC 290 ms
135,616 KB
testcase_36 AC 275 ms
133,468 KB
testcase_37 AC 270 ms
124,752 KB
testcase_38 AC 240 ms
78,876 KB
testcase_39 AC 304 ms
80,308 KB
testcase_40 AC 211 ms
78,996 KB
testcase_41 AC 249 ms
79,520 KB
testcase_42 AC 276 ms
139,072 KB
testcase_43 AC 276 ms
139,036 KB
testcase_44 AC 200 ms
100,940 KB
testcase_45 AC 197 ms
101,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Red(a):
    print("Red",a)

def Blue(b):
    print("Blue",b)

def solve():
    N,M=map(int,input().split())
    A=list(map(int,input().split()))
    B=list(map(int,input().split()))

    if N==0:
        print("Yes")
        for b in B:
            Blue(b)
        return
    elif M==0:
        print("Yes")
        for a in A:
            Red(a)
        return

    A_set=set(A)
    B_set=set(B)
    C_set=A_set & B_set

    if not C_set:
        print("No")
        return

    A_set-=C_set
    B_set-=C_set

    print("Yes")
    for a in A_set:
        Red(a)

    c=C_set.pop()
    Red(c); Blue(c)

    for b in  B_set:
        Blue(b)

    mode=0
    for c in C_set:
        if mode==0:
            Blue(c); Red(c)
        else:
            Red(c); Blue(c)
        mode^=1

    return

#==================================================
import sys
input=sys.stdin.readline
write=sys.stdout.write

T=int(input())
for t in range(T):
    solve()
0