結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー rlangevinrlangevin
提出日時 2023-05-19 21:35:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 299 ms / 2,000 ms
コード長 954 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 134,520 KB
最終ジャッジ日時 2023-08-23 02:32:15
合計ジャッジ時間 33,345 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,032 KB
testcase_01 AC 85 ms
70,792 KB
testcase_02 AC 268 ms
79,716 KB
testcase_03 AC 234 ms
80,636 KB
testcase_04 AC 222 ms
80,484 KB
testcase_05 AC 239 ms
80,984 KB
testcase_06 AC 231 ms
80,604 KB
testcase_07 AC 208 ms
80,168 KB
testcase_08 AC 249 ms
92,844 KB
testcase_09 AC 229 ms
89,668 KB
testcase_10 AC 206 ms
100,292 KB
testcase_11 AC 246 ms
90,828 KB
testcase_12 AC 220 ms
93,348 KB
testcase_13 AC 298 ms
100,188 KB
testcase_14 AC 220 ms
89,112 KB
testcase_15 AC 218 ms
95,532 KB
testcase_16 AC 245 ms
91,728 KB
testcase_17 AC 252 ms
94,708 KB
testcase_18 AC 230 ms
100,144 KB
testcase_19 AC 299 ms
125,740 KB
testcase_20 AC 272 ms
132,964 KB
testcase_21 AC 298 ms
134,520 KB
testcase_22 AC 226 ms
96,892 KB
testcase_23 AC 279 ms
133,180 KB
testcase_24 AC 271 ms
98,260 KB
testcase_25 AC 267 ms
97,168 KB
testcase_26 AC 259 ms
130,668 KB
testcase_27 AC 256 ms
96,860 KB
testcase_28 AC 286 ms
126,504 KB
testcase_29 AC 272 ms
120,840 KB
testcase_30 AC 292 ms
112,876 KB
testcase_31 AC 267 ms
132,868 KB
testcase_32 AC 262 ms
132,688 KB
testcase_33 AC 234 ms
99,796 KB
testcase_34 AC 267 ms
104,996 KB
testcase_35 AC 281 ms
119,236 KB
testcase_36 AC 262 ms
127,848 KB
testcase_37 AC 263 ms
106,084 KB
testcase_38 AC 231 ms
78,100 KB
testcase_39 AC 296 ms
79,104 KB
testcase_40 AC 219 ms
78,604 KB
testcase_41 AC 268 ms
78,580 KB
testcase_42 AC 277 ms
124,344 KB
testcase_43 AC 286 ms
124,556 KB
testcase_44 AC 206 ms
100,496 KB
testcase_45 AC 230 ms
131,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T = int(input())
for _ in range(T):
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    BS = set(B)
    if N == 0 or M == 0:
        print("Yes")
        for a in A:
            print("Red", a)
        for b in B:
            print("Blue", b)
        continue
    S = set()
    for a in A:
        if a in BS:
            S.add(a)
    if len(S) == 0:
        print("No")
        continue
    
    print("Yes")
    for a in A:
        if a not in S:
            print("Red", a)
    s = S.pop()
    print("Red", s)
    print("Blue", s)
    S.add(s)
    for b in B:
        if b not in S:
            print("Blue", b)
    S.discard(s)
    flag = 1
    while S:
        s = S.pop()
        if flag:
            print("Blue", s)
            print("Red", s)
        else:
            print("Red", s)
            print("Blue", s)
        flag = 1 - flag
0