結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー FromBooskaFromBooska
提出日時 2023-05-19 23:34:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 701 ms / 2,000 ms
コード長 1,358 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 148,076 KB
最終ジャッジ日時 2023-08-23 04:13:30
合計ジャッジ時間 34,797 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,244 KB
testcase_01 AC 77 ms
70,800 KB
testcase_02 AC 333 ms
80,224 KB
testcase_03 AC 227 ms
81,144 KB
testcase_04 AC 222 ms
80,884 KB
testcase_05 AC 217 ms
81,832 KB
testcase_06 AC 226 ms
82,300 KB
testcase_07 AC 201 ms
81,240 KB
testcase_08 AC 249 ms
98,372 KB
testcase_09 AC 229 ms
97,920 KB
testcase_10 AC 217 ms
98,604 KB
testcase_11 AC 258 ms
101,948 KB
testcase_12 AC 234 ms
110,756 KB
testcase_13 AC 303 ms
107,644 KB
testcase_14 AC 262 ms
107,688 KB
testcase_15 AC 209 ms
97,664 KB
testcase_16 AC 250 ms
97,024 KB
testcase_17 AC 252 ms
97,840 KB
testcase_18 AC 314 ms
129,632 KB
testcase_19 AC 283 ms
132,000 KB
testcase_20 AC 281 ms
148,060 KB
testcase_21 AC 298 ms
146,264 KB
testcase_22 AC 259 ms
126,148 KB
testcase_23 AC 290 ms
147,732 KB
testcase_24 AC 275 ms
122,896 KB
testcase_25 AC 274 ms
126,444 KB
testcase_26 AC 269 ms
146,544 KB
testcase_27 AC 283 ms
125,316 KB
testcase_28 AC 297 ms
141,384 KB
testcase_29 AC 293 ms
140,996 KB
testcase_30 AC 288 ms
127,764 KB
testcase_31 AC 274 ms
148,056 KB
testcase_32 AC 267 ms
148,076 KB
testcase_33 AC 260 ms
139,448 KB
testcase_34 AC 280 ms
138,904 KB
testcase_35 AC 278 ms
131,412 KB
testcase_36 AC 286 ms
140,040 KB
testcase_37 AC 295 ms
134,576 KB
testcase_38 AC 580 ms
78,624 KB
testcase_39 AC 701 ms
81,988 KB
testcase_40 AC 242 ms
78,196 KB
testcase_41 AC 274 ms
79,332 KB
testcase_42 AC 278 ms
130,660 KB
testcase_43 AC 273 ms
130,492 KB
testcase_44 AC 260 ms
145,004 KB
testcase_45 AC 256 ms
144,744 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(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