結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー FromBooskaFromBooska
提出日時 2023-05-19 23:29:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 683 ms / 2,000 ms
コード長 1,363 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 86,428 KB
実行使用メモリ 148,144 KB
最終ジャッジ日時 2023-08-23 04:14:07
合計ジャッジ時間 34,134 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,048 KB
testcase_01 AC 68 ms
71,192 KB
testcase_02 AC 319 ms
80,292 KB
testcase_03 AC 219 ms
81,124 KB
testcase_04 AC 209 ms
80,968 KB
testcase_05 AC 220 ms
81,820 KB
testcase_06 AC 220 ms
82,320 KB
testcase_07 AC 194 ms
81,348 KB
testcase_08 AC 246 ms
98,620 KB
testcase_09 AC 226 ms
97,892 KB
testcase_10 AC 201 ms
98,572 KB
testcase_11 AC 251 ms
102,228 KB
testcase_12 AC 217 ms
110,724 KB
testcase_13 AC 283 ms
107,364 KB
testcase_14 AC 227 ms
107,528 KB
testcase_15 AC 206 ms
97,664 KB
testcase_16 AC 248 ms
96,912 KB
testcase_17 AC 246 ms
97,900 KB
testcase_18 AC 251 ms
129,772 KB
testcase_19 AC 295 ms
134,316 KB
testcase_20 AC 266 ms
148,020 KB
testcase_21 AC 278 ms
146,404 KB
testcase_22 AC 240 ms
126,108 KB
testcase_23 AC 277 ms
147,728 KB
testcase_24 AC 271 ms
123,724 KB
testcase_25 AC 267 ms
126,760 KB
testcase_26 AC 257 ms
146,552 KB
testcase_27 AC 265 ms
125,244 KB
testcase_28 AC 276 ms
141,528 KB
testcase_29 AC 272 ms
141,032 KB
testcase_30 AC 284 ms
129,036 KB
testcase_31 AC 259 ms
148,144 KB
testcase_32 AC 258 ms
148,064 KB
testcase_33 AC 252 ms
139,568 KB
testcase_34 AC 281 ms
139,468 KB
testcase_35 AC 288 ms
133,344 KB
testcase_36 AC 278 ms
140,436 KB
testcase_37 AC 278 ms
134,568 KB
testcase_38 AC 538 ms
78,576 KB
testcase_39 AC 683 ms
82,244 KB
testcase_40 AC 235 ms
78,588 KB
testcase_41 AC 286 ms
79,928 KB
testcase_42 AC 280 ms
132,472 KB
testcase_43 AC 274 ms
132,452 KB
testcase_44 AC 235 ms
145,120 KB
testcase_45 AC 233 ms
145,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# test case 00 RE出る、なんでだろうね

T = int(input())
for t in range(T):
    N, M = map(int, input().split())
    A_list = list(map(int, input().split()))
    B_list = list(map(int, input().split()))
    A_set = set(A_list)
    B_set = set(B_list)
    A_solo = []
    double = []
    for a in A_list:
        if a in B_set:
            double.append(a)
        else:
            A_solo.append(a)
    B_solo = []
    for b in B_list:
        if b not in A_set:
            B_solo.append(b)
            
    #print(A_solo, double, B_solo)

    if N == 0 and M > 0:
        print('Yes')
        for b in B_list:
            print('Blue', b)
    elif N > 0 and M == 0:
        print('Yes')
        for a in A_list:
            print('Red', a)
    else:
        if len(double) == 0:
            print('No')
        else:
            print('Yes')
            double = sorted(list(double))
            for a in A_solo:
                print('Red', a)
            print('Red', double[0])
            print('Blue', double[0])
            for b in B_solo:
                print('Blue', b)
            for i in range(1, len(double)):
                if i%2 == 1:
                    print('Blue', double[i])
                    print('Red', double[i])
                else:
                    print('Red', double[i])
                    print('Blue', double[i])
0