結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,500 KB
testcase_01 AC 74 ms
71,476 KB
testcase_02 AC 287 ms
83,100 KB
testcase_03 AC 210 ms
82,632 KB
testcase_04 AC 203 ms
82,768 KB
testcase_05 AC 222 ms
82,984 KB
testcase_06 AC 221 ms
83,136 KB
testcase_07 AC 193 ms
82,544 KB
testcase_08 AC 241 ms
96,740 KB
testcase_09 AC 226 ms
91,000 KB
testcase_10 AC 199 ms
103,612 KB
testcase_11 AC 247 ms
99,224 KB
testcase_12 AC 222 ms
108,392 KB
testcase_13 AC 274 ms
105,180 KB
testcase_14 AC 226 ms
93,200 KB
testcase_15 AC 219 ms
101,332 KB
testcase_16 AC 249 ms
94,176 KB
testcase_17 AC 251 ms
98,820 KB
testcase_18 AC 271 ms
122,180 KB
testcase_19 AC 291 ms
132,472 KB
testcase_20 AC 273 ms
147,508 KB
testcase_21 AC 284 ms
146,712 KB
testcase_22 AC 270 ms
117,256 KB
testcase_23 AC 285 ms
147,844 KB
testcase_24 AC 292 ms
116,596 KB
testcase_25 AC 294 ms
118,772 KB
testcase_26 AC 266 ms
146,016 KB
testcase_27 AC 295 ms
116,428 KB
testcase_28 AC 277 ms
140,632 KB
testcase_29 AC 288 ms
138,440 KB
testcase_30 AC 291 ms
124,664 KB
testcase_31 AC 269 ms
147,788 KB
testcase_32 AC 269 ms
147,864 KB
testcase_33 AC 263 ms
127,984 KB
testcase_34 AC 293 ms
129,452 KB
testcase_35 AC 292 ms
130,636 KB
testcase_36 AC 284 ms
141,036 KB
testcase_37 AC 291 ms
127,796 KB
testcase_38 AC 406 ms
110,512 KB
testcase_39 AC 489 ms
114,364 KB
testcase_40 AC 226 ms
80,236 KB
testcase_41 AC 259 ms
81,000 KB
testcase_42 AC 274 ms
131,044 KB
testcase_43 AC 268 ms
130,768 KB
testcase_44 AC 210 ms
100,976 KB
testcase_45 AC 206 ms
100,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
NN = []
MM = []
AA = []
BB = []
for _ in range(T):
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    NN.append(n)
    MM.append(m)
    AA.append(a)
    BB.append(b)
for i in range(T):
    try:
        N = NN[i]
        M = MM[i]
        A = AA[i]
        B = BB[i]
        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")
    except:
        print("No")
0