結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,296 KB
testcase_01 AC 73 ms
71,216 KB
testcase_02 WA -
testcase_03 AC 232 ms
80,616 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 235 ms
81,836 KB
testcase_07 WA -
testcase_08 AC 251 ms
97,056 KB
testcase_09 AC 237 ms
97,132 KB
testcase_10 WA -
testcase_11 AC 267 ms
97,128 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 237 ms
102,528 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 251 ms
110,552 KB
testcase_19 AC 317 ms
123,228 KB
testcase_20 AC 289 ms
134,024 KB
testcase_21 AC 315 ms
132,484 KB
testcase_22 AC 253 ms
110,140 KB
testcase_23 AC 290 ms
133,716 KB
testcase_24 AC 296 ms
109,916 KB
testcase_25 AC 285 ms
109,564 KB
testcase_26 AC 258 ms
132,744 KB
testcase_27 AC 279 ms
109,672 KB
testcase_28 AC 278 ms
126,184 KB
testcase_29 AC 286 ms
125,472 KB
testcase_30 AC 308 ms
114,652 KB
testcase_31 AC 262 ms
133,924 KB
testcase_32 AC 264 ms
134,140 KB
testcase_33 WA -
testcase_34 AC 292 ms
127,692 KB
testcase_35 AC 312 ms
119,312 KB
testcase_36 AC 287 ms
127,984 KB
testcase_37 AC 291 ms
114,164 KB
testcase_38 AC 551 ms
78,424 KB
testcase_39 AC 714 ms
81,676 KB
testcase_40 AC 260 ms
78,856 KB
testcase_41 AC 309 ms
79,820 KB
testcase_42 AC 308 ms
122,904 KB
testcase_43 AC 303 ms
122,876 KB
testcase_44 AC 248 ms
131,384 KB
testcase_45 AC 241 ms
131,716 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 and M == 0:
        print('Yes')
    elif N == 0:
        print('Yes')
        for b in B:
            print('Blue', b)
    elif M == 0:
        print('Yes')
        for a in A:
            print('Red', a)
    else:
        if len(A_double) == 0:
            print('No')
        else:
            print('Yes')
            A_double = sorted(list(A_double))
            B_double = sorted(list(B_double))

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