結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー ああいい
提出日時 2023-05-22 22:54:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 903 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 134,892 KB
最終ジャッジ日時 2024-12-22 16:42:58
合計ジャッジ時間 29,234 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

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()))
    a = set(A)
    b = set(B)
    c = a & b

    if N == 0:
        print('Yes')
        for bb in B:
            print('Blue',bb)
        continue
    if M == 0:
        print('Yes')
        for aa in A:
            print('Red',aa)
        continue
    if len(c) == 0:
        print('No')
        continue
    print('Yes')
    for aa in A:
        if aa not in c:
            print('Red',aa)

    u = c.pop()
    print('Red',u)
    print('Blue',u)
    for bb in B:
        if bb not in c and bb != u:
            print('Blue',u)
    now = True
    while c:
        u = c.pop()
        if now:
            print("Blue",u)
            print("Red",u)
        else:
            print('Red',u)
            print('Blue',u)
        now = not now
            
0