結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー FromBooskaFromBooska
提出日時 2023-05-19 22:52:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,528 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 134,304 KB
最終ジャッジ日時 2023-08-23 03:57:39
合計ジャッジ時間 34,407 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,100 KB
testcase_01 AC 75 ms
71,112 KB
testcase_02 WA -
testcase_03 AC 225 ms
80,748 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 222 ms
81,584 KB
testcase_07 WA -
testcase_08 AC 246 ms
97,584 KB
testcase_09 AC 229 ms
97,036 KB
testcase_10 AC 210 ms
105,388 KB
testcase_11 AC 258 ms
98,692 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 225 ms
102,728 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 264 ms
110,524 KB
testcase_19 AC 312 ms
123,316 KB
testcase_20 AC 261 ms
134,304 KB
testcase_21 AC 282 ms
132,924 KB
testcase_22 AC 245 ms
109,796 KB
testcase_23 AC 286 ms
133,956 KB
testcase_24 AC 290 ms
109,908 KB
testcase_25 AC 276 ms
109,760 KB
testcase_26 AC 254 ms
132,616 KB
testcase_27 AC 274 ms
110,004 KB
testcase_28 AC 282 ms
126,336 KB
testcase_29 AC 281 ms
125,548 KB
testcase_30 AC 305 ms
114,560 KB
testcase_31 AC 270 ms
134,048 KB
testcase_32 AC 253 ms
133,968 KB
testcase_33 WA -
testcase_34 AC 289 ms
127,656 KB
testcase_35 AC 320 ms
119,376 KB
testcase_36 AC 290 ms
127,636 KB
testcase_37 AC 279 ms
113,996 KB
testcase_38 AC 528 ms
78,572 KB
testcase_39 AC 716 ms
81,552 KB
testcase_40 AC 257 ms
78,932 KB
testcase_41 AC 302 ms
79,644 KB
testcase_42 AC 327 ms
122,588 KB
testcase_43 AC 310 ms
123,232 KB
testcase_44 AC 238 ms
131,640 KB
testcase_45 AC 237 ms
131,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 貪欲法

T = int(input())
for t in range(T):
    N, M = map(int, input().split())
    A = set(map(int, input().split()))
    B = set(map(int, input().split()))
    A_solo = []
    A_double = []
    for a in A:
        if a in B:
            A_double.append(a)
        else:
            A_solo.append(a)
    B_solo = []
    B_double = []
    for b in B:
        if b in A:
            B_double.append(b)
        else:
            B_solo.append(b)

    #print(A_solo, A_double)
    #print(B_solo, B_double)

    if N == 0:
        print('Yes')
        for b in B:
            print('Blue', b)
    elif M == 0:
        print('Yes')
        for a in A:
            print('Red', a)
    elif len(A_double) == 0:
        print('No')
    else:
        print('Yes')

        A_double = sorted(list(A_double))
        B_double = sorted(list(B_double))
        #print(A_solo, A_double, B_solo, B_double)
        
        for i in range(len(A_double)):
            if i == 0:
                for a in A_solo:
                    print('Red', a)
                print('Red', A_double[i])
                print('Blue', B_double[i])
            elif i == 1:
                for b in B_solo:
                    print('Blue', b)
                print('Blue', B_double[i])
                print('Red', A_double[i])
            elif i%2 == 0:
                print('Red', A_double[i])
                print('Blue', B_double[i])
            else:
                print('Blue', B_double[i])
                print('Red', A_double[i])            
0