結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー qibqib
提出日時 2023-05-20 14:18:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 426 ms / 2,000 ms
コード長 722 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 156,004 KB
最終ジャッジ日時 2023-08-23 09:35:51
合計ジャッジ時間 32,003 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
70,872 KB
testcase_01 AC 71 ms
71,252 KB
testcase_02 AC 259 ms
91,544 KB
testcase_03 AC 165 ms
90,672 KB
testcase_04 AC 162 ms
90,784 KB
testcase_05 AC 163 ms
89,900 KB
testcase_06 AC 166 ms
91,072 KB
testcase_07 AC 185 ms
87,892 KB
testcase_08 AC 184 ms
106,312 KB
testcase_09 AC 173 ms
98,920 KB
testcase_10 AC 165 ms
108,120 KB
testcase_11 AC 196 ms
112,368 KB
testcase_12 AC 191 ms
112,668 KB
testcase_13 AC 213 ms
113,468 KB
testcase_14 AC 182 ms
103,020 KB
testcase_15 AC 156 ms
99,144 KB
testcase_16 AC 196 ms
106,200 KB
testcase_17 AC 221 ms
104,468 KB
testcase_18 AC 211 ms
117,736 KB
testcase_19 AC 242 ms
141,496 KB
testcase_20 AC 224 ms
153,904 KB
testcase_21 AC 249 ms
152,828 KB
testcase_22 AC 202 ms
118,592 KB
testcase_23 AC 221 ms
152,368 KB
testcase_24 AC 220 ms
118,624 KB
testcase_25 AC 213 ms
118,500 KB
testcase_26 AC 215 ms
151,576 KB
testcase_27 AC 209 ms
118,748 KB
testcase_28 AC 216 ms
143,340 KB
testcase_29 AC 214 ms
140,268 KB
testcase_30 AC 228 ms
127,260 KB
testcase_31 AC 219 ms
153,868 KB
testcase_32 AC 238 ms
153,728 KB
testcase_33 AC 216 ms
143,860 KB
testcase_34 AC 223 ms
144,856 KB
testcase_35 AC 234 ms
135,552 KB
testcase_36 AC 231 ms
145,712 KB
testcase_37 AC 219 ms
121,300 KB
testcase_38 AC 368 ms
105,392 KB
testcase_39 AC 426 ms
118,996 KB
testcase_40 AC 201 ms
102,136 KB
testcase_41 AC 223 ms
102,636 KB
testcase_42 AC 236 ms
143,412 KB
testcase_43 AC 234 ms
143,480 KB
testcase_44 AC 225 ms
156,004 KB
testcase_45 AC 226 ms
155,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())

color = ["Red", "Blue"]

ans = []
for _ in range(t):
  n, m = map(int, input().split())
  a = set(list(map(int, input().split())))
  b = set(list(map(int, input().split())))

  xs = a & b
  if len(a) > 0 and len(b) > 0 and len(xs) == 0:
    ans.append("No")
    continue

  a -= xs
  b -= xs
  xs = list(xs)

  ans.append("Yes")
  for x in b:
    ans.append(color[1] + " " + str(x))

  if len(xs) > 0:
    x = xs.pop()
    ans.append(color[1] + " " + str(x))
    ans.append(color[0] + " " + str(x))

  for x in a:
    ans.append(color[0] + " " + str(x))

  for i in range(len(xs)):
    ans.append(color[i % 2] + " " + str(xs[i]))
    ans.append(color[1 - i % 2] + " " + str(xs[i]))

print(*ans, sep="\n")
0