結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー 倉
提出日時 2023-05-19 22:02:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 390 ms / 2,000 ms
コード長 1,105 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 165,432 KB
最終ジャッジ日時 2023-08-23 03:13:19
合計ジャッジ時間 35,958 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
72,308 KB
testcase_01 AC 127 ms
72,464 KB
testcase_02 AC 325 ms
80,144 KB
testcase_03 AC 278 ms
83,460 KB
testcase_04 AC 264 ms
82,628 KB
testcase_05 AC 260 ms
82,100 KB
testcase_06 AC 260 ms
83,696 KB
testcase_07 AC 249 ms
82,832 KB
testcase_08 AC 278 ms
105,212 KB
testcase_09 AC 275 ms
107,624 KB
testcase_10 AC 263 ms
110,564 KB
testcase_11 AC 311 ms
104,412 KB
testcase_12 AC 268 ms
121,696 KB
testcase_13 AC 312 ms
105,168 KB
testcase_14 AC 279 ms
116,136 KB
testcase_15 AC 255 ms
105,096 KB
testcase_16 AC 291 ms
99,628 KB
testcase_17 AC 300 ms
106,432 KB
testcase_18 AC 307 ms
131,368 KB
testcase_19 AC 322 ms
131,816 KB
testcase_20 AC 329 ms
165,236 KB
testcase_21 AC 339 ms
158,936 KB
testcase_22 AC 285 ms
124,844 KB
testcase_23 AC 347 ms
162,032 KB
testcase_24 AC 320 ms
119,216 KB
testcase_25 AC 323 ms
125,480 KB
testcase_26 AC 334 ms
161,328 KB
testcase_27 AC 327 ms
123,248 KB
testcase_28 AC 338 ms
152,412 KB
testcase_29 AC 330 ms
152,040 KB
testcase_30 AC 323 ms
124,708 KB
testcase_31 AC 347 ms
165,432 KB
testcase_32 AC 330 ms
165,348 KB
testcase_33 AC 318 ms
157,556 KB
testcase_34 AC 322 ms
135,296 KB
testcase_35 AC 341 ms
129,672 KB
testcase_36 AC 337 ms
151,120 KB
testcase_37 AC 334 ms
135,764 KB
testcase_38 AC 333 ms
80,108 KB
testcase_39 AC 390 ms
80,788 KB
testcase_40 AC 270 ms
80,144 KB
testcase_41 AC 287 ms
80,468 KB
testcase_42 AC 296 ms
127,060 KB
testcase_43 AC 311 ms
127,120 KB
testcase_44 AC 282 ms
137,616 KB
testcase_45 AC 277 ms
137,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from functools import partial
# import pypyjit
# pypyjit.set_param('max_unroll_recursion = -1')

sys.setrecursionlimit(500005)
stdin = sys.stdin

ns = lambda: stdin.readline().strip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nz = lambda: list(map(lambda x: int(x)-1, stdin.readline().split())) # 遅い
printa = partial(print, sep="\n") # printa(*A) で各要素を改行して出力
mod = 1000000007 # 998244353
inf = 10 ** 18

T = ni()

def solve():
    N, M = na()
    A = set(na())
    B = set(na())
    C = A & B
    Red = A - C
    Blue = B - C
    if N and M and not C:
        print("No")
        return
    print("Yes")
    if Red:
        for r in Red:
            print("Red", r)
    if C:
        x = C.pop()
        print("Red", x)
        print("Blue", x)
    if Blue:
        for b in Blue:
            print("Blue", b)
    f = 0
    for c in C:
        if not f:
            print("Blue", c)
            print("Red", c)
        else:
            print("Red", c)
            print("Blue", c)
        f = f ^ 1


for i in range(T):
    solve()
0