結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー miho-4
提出日時 2023-05-19 22:15:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 827 ms / 2,000 ms
コード長 710 bytes
コンパイル時間 826 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 136,932 KB
最終ジャッジ日時 2024-12-21 03:00:11
合計ジャッジ時間 33,268 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

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()))
  SA,SB=set(A),set(B)
  S=SA&SB
  
  if 0<n and 0<m and len(S)==0:
    print("No")
    continue
  
  print("Yes")
  if n==0:
    for e in SB:
      print("Blue",e)
    continue
    
  if m==0:
    for e in SA:
      print("Red",e)
    continue
      
  LS=list(S)
  SA-=S
  SB-=S
  for e in SA:
    print("Red",e)
  print("Red",LS[0])
  print("Blue",LS[0])
  for e in SB:
    print("Blue",e)
  if 1<len(LS):
    for i in range(1,len(LS)):
      e=LS[i]
      if i%2==1:
        print("Blue",e)
        print("Red",e)
      else:
        print("Red",e)
        print("Blue",e)
0