結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー 👑 rin204rin204
提出日時 2024-05-04 16:07:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 553 ms / 2,000 ms
コード長 741 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 82,760 KB
実行使用メモリ 120,320 KB
最終ジャッジ日時 2024-05-04 16:07:49
合計ジャッジ時間 31,360 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,096 KB
testcase_01 AC 36 ms
52,480 KB
testcase_02 AC 299 ms
77,312 KB
testcase_03 AC 156 ms
79,028 KB
testcase_04 AC 146 ms
79,360 KB
testcase_05 AC 168 ms
78,976 KB
testcase_06 AC 154 ms
78,464 KB
testcase_07 AC 128 ms
78,464 KB
testcase_08 AC 161 ms
96,384 KB
testcase_09 AC 163 ms
93,440 KB
testcase_10 AC 152 ms
94,736 KB
testcase_11 AC 189 ms
98,360 KB
testcase_12 AC 171 ms
100,440 KB
testcase_13 AC 199 ms
98,952 KB
testcase_14 AC 165 ms
96,384 KB
testcase_15 AC 168 ms
94,476 KB
testcase_16 AC 193 ms
90,240 KB
testcase_17 AC 176 ms
94,336 KB
testcase_18 AC 217 ms
107,776 KB
testcase_19 AC 225 ms
116,744 KB
testcase_20 AC 193 ms
117,872 KB
testcase_21 AC 208 ms
119,592 KB
testcase_22 AC 178 ms
110,720 KB
testcase_23 AC 236 ms
118,528 KB
testcase_24 AC 199 ms
110,464 KB
testcase_25 AC 202 ms
110,720 KB
testcase_26 AC 184 ms
116,004 KB
testcase_27 AC 199 ms
110,464 KB
testcase_28 AC 202 ms
113,192 KB
testcase_29 AC 194 ms
109,796 KB
testcase_30 AC 259 ms
108,604 KB
testcase_31 AC 193 ms
118,696 KB
testcase_32 AC 186 ms
118,896 KB
testcase_33 AC 200 ms
120,320 KB
testcase_34 AC 192 ms
118,016 KB
testcase_35 AC 216 ms
112,964 KB
testcase_36 AC 211 ms
115,356 KB
testcase_37 AC 201 ms
109,184 KB
testcase_38 AC 483 ms
77,056 KB
testcase_39 AC 553 ms
78,080 KB
testcase_40 AC 179 ms
77,184 KB
testcase_41 AC 200 ms
77,188 KB
testcase_42 AC 210 ms
116,352 KB
testcase_43 AC 218 ms
116,612 KB
testcase_44 AC 179 ms
117,164 KB
testcase_45 AC 179 ms
116,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    n, m = map(int, input().split())
    A = set(map(int, input().split()))
    B = set(map(int, input().split()))

    if not A:
        print("Yes")
        for b in B:
            print("Blue", b)
        return
    if not B:
        print("Yes")
        for a in A:
            print("Red", a)
        return

    same = A & B
    if len(same) == 0:
        print("No")
        return
    print("Yes")
    A -= same
    B -= same
    p = same.pop()
    for a in A:
        print("Red", a)
    print("Red", p)
    print("Blue", p)
    for b in B:
        print("Blue", b)

    r = "Red"
    b = "Blue"
    for p in same:
        print(b, p)
        print(r, p)
        r, b = b, r


for _ in range(int(input())):
    solve()
0