結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー miya145592miya145592
提出日時 2023-05-19 23:42:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 738 ms / 2,000 ms
コード長 1,176 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 147,780 KB
最終ジャッジ日時 2023-08-23 04:12:55
合計ジャッジ時間 33,688 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,196 KB
testcase_01 AC 75 ms
71,368 KB
testcase_02 AC 301 ms
78,800 KB
testcase_03 AC 216 ms
80,420 KB
testcase_04 AC 207 ms
81,292 KB
testcase_05 AC 220 ms
81,604 KB
testcase_06 AC 227 ms
81,844 KB
testcase_07 AC 192 ms
80,492 KB
testcase_08 AC 245 ms
99,220 KB
testcase_09 AC 237 ms
97,816 KB
testcase_10 AC 217 ms
109,028 KB
testcase_11 AC 252 ms
101,008 KB
testcase_12 AC 220 ms
109,936 KB
testcase_13 AC 282 ms
104,800 KB
testcase_14 AC 222 ms
102,712 KB
testcase_15 AC 216 ms
98,348 KB
testcase_16 AC 249 ms
95,624 KB
testcase_17 AC 255 ms
97,836 KB
testcase_18 AC 268 ms
122,232 KB
testcase_19 AC 283 ms
132,456 KB
testcase_20 AC 261 ms
147,576 KB
testcase_21 AC 276 ms
146,528 KB
testcase_22 AC 262 ms
117,068 KB
testcase_23 AC 278 ms
147,468 KB
testcase_24 AC 293 ms
116,388 KB
testcase_25 AC 287 ms
118,560 KB
testcase_26 AC 245 ms
145,868 KB
testcase_27 AC 279 ms
116,216 KB
testcase_28 AC 264 ms
140,584 KB
testcase_29 AC 270 ms
138,368 KB
testcase_30 AC 279 ms
124,556 KB
testcase_31 AC 256 ms
147,780 KB
testcase_32 AC 251 ms
147,776 KB
testcase_33 AC 246 ms
127,708 KB
testcase_34 AC 275 ms
129,360 KB
testcase_35 AC 278 ms
130,404 KB
testcase_36 AC 270 ms
140,212 KB
testcase_37 AC 304 ms
127,728 KB
testcase_38 AC 549 ms
78,384 KB
testcase_39 AC 738 ms
81,528 KB
testcase_40 AC 220 ms
78,372 KB
testcase_41 AC 258 ms
80,232 KB
testcase_42 AC 275 ms
130,956 KB
testcase_43 AC 279 ms
130,892 KB
testcase_44 AC 206 ms
100,980 KB
testcase_45 AC 209 ms
100,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    N, M = map(int, input().split())
    try:
        A = list(map(int, input().split()))
        B = list(map(int, input().split()))
    except:
        if N==0:
            A = []
        if M==0:
            B = []
    if N>0 and M>0:
        setA = set(A)
        setB = set(B)
        same = []
        diff = []
        for b in B:
            if b in setA:
                same.append(b)
            else:
                diff.append(b)
        if len(same)==0:
            print("No")
            continue

        print("Yes")
        for d in diff:
            print("Blue", d)
        for i, s in enumerate(same):
            if i%2==0:
                print("Blue", s)
                print("Red", s)
                if i==0:
                    for a in setA:
                        if a not in setB:
                            print("Red", a)
            else:
                print("Red", s)
                print("Blue", s)

    elif N>0:
        print("Yes")
        for a in A:
            print("Red", a)
    elif M>0:
        print("Yes")
        for b in B:
            print("Blue", b)
    else:
        print("Yes")
0