結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー chankei271828chankei271828
提出日時 2023-05-19 21:59:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 763 ms / 2,000 ms
コード長 1,601 bytes
コンパイル時間 1,254 ms
コンパイル使用メモリ 86,560 KB
実行使用メモリ 135,960 KB
最終ジャッジ日時 2023-08-23 03:05:37
合計ジャッジ時間 34,318 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,164 KB
testcase_01 AC 75 ms
71,032 KB
testcase_02 AC 354 ms
80,488 KB
testcase_03 AC 222 ms
81,348 KB
testcase_04 AC 214 ms
80,652 KB
testcase_05 AC 227 ms
81,112 KB
testcase_06 AC 225 ms
81,628 KB
testcase_07 AC 191 ms
80,272 KB
testcase_08 AC 254 ms
99,072 KB
testcase_09 AC 228 ms
97,816 KB
testcase_10 AC 207 ms
105,564 KB
testcase_11 AC 268 ms
101,056 KB
testcase_12 AC 225 ms
108,500 KB
testcase_13 AC 278 ms
99,480 KB
testcase_14 AC 232 ms
103,196 KB
testcase_15 AC 220 ms
98,948 KB
testcase_16 AC 247 ms
94,292 KB
testcase_17 AC 250 ms
98,024 KB
testcase_18 AC 243 ms
117,896 KB
testcase_19 AC 289 ms
131,704 KB
testcase_20 AC 259 ms
135,780 KB
testcase_21 AC 279 ms
135,960 KB
testcase_22 AC 238 ms
114,012 KB
testcase_23 AC 285 ms
135,904 KB
testcase_24 AC 290 ms
115,904 KB
testcase_25 AC 280 ms
116,528 KB
testcase_26 AC 256 ms
134,612 KB
testcase_27 AC 268 ms
114,212 KB
testcase_28 AC 274 ms
131,084 KB
testcase_29 AC 269 ms
129,184 KB
testcase_30 AC 283 ms
124,808 KB
testcase_31 AC 264 ms
135,868 KB
testcase_32 AC 261 ms
135,772 KB
testcase_33 AC 256 ms
127,684 KB
testcase_34 AC 282 ms
129,004 KB
testcase_35 AC 288 ms
129,468 KB
testcase_36 AC 273 ms
131,692 KB
testcase_37 AC 273 ms
123,680 KB
testcase_38 AC 550 ms
78,316 KB
testcase_39 AC 763 ms
81,652 KB
testcase_40 AC 248 ms
78,320 KB
testcase_41 AC 286 ms
79,904 KB
testcase_42 AC 279 ms
130,912 KB
testcase_43 AC 310 ms
130,776 KB
testcase_44 AC 263 ms
131,376 KB
testcase_45 AC 238 ms
131,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for _ in range(T):
    N,M=map(int,input().split())
    A=list(map(int,input().split()))
    B=list(map(int,input().split()))
    s_A=set(A)
    s_B=set(B)
    if  not s_A:
        print('Yes')
        for t in s_B:
            print('Blue',t)
        continue
    if not s_B:
        print('Yes')
        for t in s_A:
            print('Red',t)
        continue
    for t in A:
        if t in s_B:
            break
    else:
        print('No')
        continue
    print('Yes')
    cnt=0
    ans=[]
    for t in A:
        if t in s_B:
            s_A.remove(t)
            s_B.remove(t)
            cnt+=1
            ans.append(t)
    if not s_A:
        for t in s_B:
            print('Blue',t)
        for i in range(cnt):
            if i%2==0:
                print('Blue',ans[i])
                print('Red',ans[i])
            else:
                print('Red',ans[i])
                print('Blue',ans[i])
    elif not s_B:
        for t in s_A:
            print('Red',t)
        for i in range(cnt):
            if i%2==0:
                print('Red',ans[i])
                print('Blue',ans[i])
            else:
                print('Blue',ans[i])
                print('Red',ans[i])
    else:
        for t in s_A:
            print('Red',t)
        print('Red',ans[0])
        print('Blue',ans[0])
        for t in s_B:
            print('Blue',t)
        for i in range(1,cnt):
            if i%2==1:
                print('Blue',ans[i])
                print('Red',ans[i])
            else:
                print('Red',ans[i])
                print('Blue',ans[i])
0