結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー FromBooskaFromBooska
提出日時 2023-05-19 22:53:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,550 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 86,488 KB
実行使用メモリ 133,904 KB
最終ジャッジ日時 2023-08-23 03:58:50
合計ジャッジ時間 33,657 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,072 KB
testcase_01 AC 75 ms
71,200 KB
testcase_02 WA -
testcase_03 AC 226 ms
80,400 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 223 ms
81,032 KB
testcase_07 WA -
testcase_08 AC 241 ms
96,880 KB
testcase_09 AC 232 ms
96,592 KB
testcase_10 AC 212 ms
105,276 KB
testcase_11 AC 257 ms
98,208 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 232 ms
102,496 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 252 ms
110,024 KB
testcase_19 AC 313 ms
122,952 KB
testcase_20 AC 264 ms
133,824 KB
testcase_21 AC 288 ms
132,448 KB
testcase_22 AC 254 ms
109,556 KB
testcase_23 AC 285 ms
133,824 KB
testcase_24 AC 285 ms
109,496 KB
testcase_25 AC 281 ms
109,496 KB
testcase_26 AC 260 ms
132,372 KB
testcase_27 AC 271 ms
109,740 KB
testcase_28 AC 290 ms
126,172 KB
testcase_29 AC 273 ms
125,308 KB
testcase_30 AC 309 ms
114,252 KB
testcase_31 AC 263 ms
133,904 KB
testcase_32 AC 259 ms
133,724 KB
testcase_33 WA -
testcase_34 AC 305 ms
127,432 KB
testcase_35 AC 317 ms
119,320 KB
testcase_36 AC 289 ms
127,320 KB
testcase_37 AC 293 ms
113,904 KB
testcase_38 AC 527 ms
77,908 KB
testcase_39 AC 699 ms
80,964 KB
testcase_40 AC 256 ms
78,740 KB
testcase_41 AC 295 ms
78,556 KB
testcase_42 AC 309 ms
122,912 KB
testcase_43 AC 304 ms
122,880 KB
testcase_44 AC 244 ms
131,336 KB
testcase_45 AC 242 ms
131,248 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')
        for b in B:
            print('Blue', b)
    elif M == 0 and N != 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