結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー とろちゃとろちゃ
提出日時 2023-05-19 22:37:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,793 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 86,516 KB
実行使用メモリ 145,248 KB
最終ジャッジ日時 2023-08-23 03:49:26
合計ジャッジ時間 29,966 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,012 KB
testcase_01 AC 75 ms
71,328 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 289 ms
130,104 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 253 ms
78,908 KB
testcase_39 AC 372 ms
80,736 KB
testcase_40 AC 169 ms
77,536 KB
testcase_41 AC 275 ms
79,992 KB
testcase_42 AC 272 ms
115,264 KB
testcase_43 AC 269 ms
115,520 KB
testcase_44 AC 220 ms
145,248 KB
testcase_45 AC 216 ms
144,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1")
# from bisect import *
# from collections import *
# from heapq import *
# from itertools import *
# from math import *
# from datetime import *
# from decimal import*
# from string import ascii_lowercase,ascii_uppercase
# import numpy as np
import sys
import os

# sys.setrecursionlimit(10**6)
INF = 10**18
MOD = 998244353
# MOD = 10**9 + 7
File = open("input.txt", "r") if os.path.exists("input.txt") else sys.stdin


def input():
    return File.readline()[:-1]


# ///////////////////////////////////////////////////////////////////////////


T = int(input())


def f(l, s):
    res = 0
    flag = [0] * (len(l) + 1)
    for i in range(len(l)):
        if l[i] in s:
            flag[i] = 1
            res += 1
    return flag, res


for _ in range(T):
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    As = set(A)
    B = list(map(int, input().split()))
    Bs = set(B)
    if len(A) == 0 or len(B) == 0:
        print("Yes")
        print(*["Red " + str(i) for i in A], sep="\n") if len(A) else print(
            *["Blue " + str(i) for i in B], sep="\n"
        )
        continue
    flagA, cnt1 = f(A, Bs)
    flagB, cnt2 = f(B, As)

    if cnt1 == 0 or cnt2 == 0:
        print("No")
        continue

    print("Yes")

    for i in range(N):
        if not flagA[i]:
            print("Red", A[i])

    parity = 1
    for i in range(N):
        if flagA[i]:
            if parity:
                print("Red", A[i])
                print("Blue", A[i])
            else:
                print("Blue", A[i])
                print("Red", A[i])
            parity ^= 1
        if i == 1:
            for j in range(M):
                if not flagB[j]:
                    print("Blue", B[j])
0