結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー 👑 timitimi
提出日時 2023-05-19 22:34:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,369 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 86,760 KB
実行使用メモリ 149,892 KB
最終ジャッジ日時 2023-08-23 03:46:09
合計ジャッジ時間 31,950 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,168 KB
testcase_01 AC 77 ms
71,256 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 AC 276 ms
103,216 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 297 ms
132,988 KB
testcase_19 WA -
testcase_20 AC 316 ms
149,892 KB
testcase_21 AC 314 ms
144,144 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 312 ms
128,256 KB
testcase_28 WA -
testcase_29 AC 312 ms
144,620 KB
testcase_30 WA -
testcase_31 AC 306 ms
149,312 KB
testcase_32 WA -
testcase_33 AC 288 ms
142,048 KB
testcase_34 AC 302 ms
138,756 KB
testcase_35 AC 291 ms
119,420 KB
testcase_36 WA -
testcase_37 AC 314 ms
135,340 KB
testcase_38 AC 557 ms
79,164 KB
testcase_39 AC 697 ms
80,684 KB
testcase_40 AC 271 ms
78,532 KB
testcase_41 AC 294 ms
79,264 KB
testcase_42 AC 264 ms
115,876 KB
testcase_43 AC 269 ms
117,004 KB
testcase_44 AC 275 ms
145,252 KB
testcase_45 AC 281 ms
145,276 KB
権限があれば一括ダウンロードができます

ソースコード

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()))
  D={}
  for a in A:
    D[a]=1
  for b in B:
    if b in D:
      D[b]=2
    else:
      D[b]=-1
  r,b,c=0,0,0
  R,B,C=[],[],[]
  for d in D:
    if D[d]==2:
      c+=1
      C.append(d)
    elif D[d]==1:
      r+=1
      R.append(d)
    else:
      b+=1 
      B.append(d)
  ans=[]
  if c==0:
    if r==0 or b==0:
      print('Yes')
      if r==0:
        for i in B:
          print('Blue',i)
      else:
        for i in R:
          print('Red',i)
    else:
      print('No')
  elif c%2==0:
    if b==0:
      print('Yes')
      for i in R:
        print('Red',i)
      for i in range(c//2):
        x,y=C[2*i],C[2*i+1]
        print('Red',x)
        print('Blue',x)
        print('Blue',y)
        print('Red',y)
    elif r==0:
      print('Yes')
      for i in B:
        print('Blue',i)
      for i in range(c//2):
        x,y=C[2*i],C[2*i+1]
        print('Blue',x)
        print('Red',x)
        print('Red',y)
        print('Blue',y)
    else:
      print('Yes')
  else:
    print('Yes')
    for i in R:
      print('Red',i)
    for i in range(c):
      if i%2==0:
        print('Red',C[i])
        print('Blue',C[i])
      else:
        print('Blue',C[i])
        print('Red',C[i])
    for i in B:
      print('Blue',i)
0