結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー chankei271828chankei271828
提出日時 2023-05-19 22:52:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 748 ms / 2,000 ms
コード長 1,625 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 86,844 KB
実行使用メモリ 136,036 KB
最終ジャッジ日時 2023-08-23 03:56:25
合計ジャッジ時間 33,219 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
70,912 KB
testcase_01 AC 71 ms
71,064 KB
testcase_02 AC 336 ms
80,404 KB
testcase_03 AC 220 ms
81,284 KB
testcase_04 AC 205 ms
80,656 KB
testcase_05 AC 217 ms
81,268 KB
testcase_06 AC 214 ms
81,516 KB
testcase_07 AC 183 ms
80,040 KB
testcase_08 AC 248 ms
98,820 KB
testcase_09 AC 224 ms
97,920 KB
testcase_10 AC 198 ms
105,604 KB
testcase_11 AC 255 ms
100,808 KB
testcase_12 AC 212 ms
108,728 KB
testcase_13 AC 268 ms
99,656 KB
testcase_14 AC 215 ms
102,908 KB
testcase_15 AC 207 ms
98,872 KB
testcase_16 AC 234 ms
94,068 KB
testcase_17 AC 238 ms
98,084 KB
testcase_18 AC 233 ms
117,984 KB
testcase_19 AC 281 ms
131,544 KB
testcase_20 AC 248 ms
135,680 KB
testcase_21 AC 270 ms
136,036 KB
testcase_22 AC 233 ms
114,268 KB
testcase_23 AC 268 ms
135,916 KB
testcase_24 AC 271 ms
115,896 KB
testcase_25 AC 264 ms
116,512 KB
testcase_26 AC 244 ms
134,564 KB
testcase_27 AC 264 ms
114,096 KB
testcase_28 AC 271 ms
131,296 KB
testcase_29 AC 263 ms
128,780 KB
testcase_30 AC 287 ms
124,680 KB
testcase_31 AC 250 ms
135,400 KB
testcase_32 AC 256 ms
135,272 KB
testcase_33 AC 246 ms
127,632 KB
testcase_34 AC 270 ms
128,920 KB
testcase_35 AC 290 ms
129,192 KB
testcase_36 AC 270 ms
131,836 KB
testcase_37 AC 276 ms
123,388 KB
testcase_38 AC 529 ms
78,276 KB
testcase_39 AC 748 ms
82,256 KB
testcase_40 AC 249 ms
78,344 KB
testcase_41 AC 279 ms
79,876 KB
testcase_42 AC 273 ms
130,804 KB
testcase_43 AC 279 ms
130,636 KB
testcase_44 AC 232 ms
131,516 KB
testcase_45 AC 229 ms
131,284 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 and t in s_A:
            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])
print('\n')
0