結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー miho-4
提出日時 2023-05-20 00:25:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 770 ms / 2,000 ms
コード長 710 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 82,144 KB
実行使用メモリ 137,128 KB
最終ジャッジ日時 2024-12-20 03:45:11
合計ジャッジ時間 31,068 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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