結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー anonymouslyanonymously
提出日時 2023-05-19 22:51:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,246 ms / 2,000 ms
コード長 1,255 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 10,768 KB
実行使用メモリ 46,116 KB
最終ジャッジ日時 2023-08-23 03:55:46
合計ジャッジ時間 34,766 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,092 KB
testcase_01 AC 15 ms
7,948 KB
testcase_02 AC 212 ms
8,280 KB
testcase_03 AC 159 ms
10,984 KB
testcase_04 AC 160 ms
11,188 KB
testcase_05 AC 156 ms
10,604 KB
testcase_06 AC 160 ms
11,412 KB
testcase_07 AC 139 ms
11,216 KB
testcase_08 AC 193 ms
21,864 KB
testcase_09 AC 190 ms
18,136 KB
testcase_10 AC 177 ms
25,708 KB
testcase_11 AC 235 ms
29,924 KB
testcase_12 AC 175 ms
24,340 KB
testcase_13 AC 286 ms
28,000 KB
testcase_14 AC 195 ms
24,964 KB
testcase_15 AC 156 ms
19,328 KB
testcase_16 AC 226 ms
20,260 KB
testcase_17 AC 190 ms
22,420 KB
testcase_18 AC 308 ms
33,908 KB
testcase_19 AC 344 ms
41,556 KB
testcase_20 AC 337 ms
46,116 KB
testcase_21 AC 331 ms
43,792 KB
testcase_22 AC 313 ms
30,696 KB
testcase_23 AC 336 ms
45,188 KB
testcase_24 AC 326 ms
32,864 KB
testcase_25 AC 316 ms
33,076 KB
testcase_26 AC 332 ms
45,928 KB
testcase_27 AC 305 ms
30,644 KB
testcase_28 AC 314 ms
33,632 KB
testcase_29 AC 313 ms
33,712 KB
testcase_30 AC 326 ms
34,864 KB
testcase_31 AC 322 ms
45,984 KB
testcase_32 AC 334 ms
46,060 KB
testcase_33 AC 325 ms
41,508 KB
testcase_34 AC 335 ms
42,412 KB
testcase_35 AC 330 ms
37,536 KB
testcase_36 AC 327 ms
40,728 KB
testcase_37 AC 317 ms
33,628 KB
testcase_38 AC 1,122 ms
8,320 KB
testcase_39 AC 1,246 ms
8,224 KB
testcase_40 AC 216 ms
8,636 KB
testcase_41 AC 257 ms
8,656 KB
testcase_42 AC 335 ms
41,928 KB
testcase_43 AC 341 ms
42,024 KB
testcase_44 AC 289 ms
40,132 KB
testcase_45 AC 284 ms
40,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding:utf-8
#方針:
#赤・青両方にある数字の個数がかっこよさの最大値
#手順:
#1.赤にあり、青にない数字を全部食べる
#2.赤青ともにある数字を1個食べる
#3.青にあり、赤にない数字を全部食べる
#4.青⇒赤⇒赤⇒青⇒…の順に全部食べる

t=int(input())
for _ in range(t):
	n,m=map(int,input().split())
	a=set(map(int,input().split()))
	b=set()
	if _<t-1 or m>0:
		b=set(map(int,input().split()))
	if m==0:
		print("Yes")
		#赤すべて食べる
		for x in a:
			print(f"Red {x}")
	elif n==0:
		print("Yes")
		#青すべて食べる
		for y in b:
			print(f"Blue {y}")
	else:
		c=a & b
		if c:
			print("Yes")
			d = a ^ c # 赤にあって青にない
			for x in d:
				print(f"Red {x}")

			for x in c:
				#1回だけ出力
				print(f"Red {x}")
				print(f"Blue {x}")
				break
			
			
			e = b ^ c # 青にあって赤にない
			for y in e:
				print(f"Blue {y}")
			
			i=0
			for x in c:
				if i:
                    # 最初を除いて出力
					if i%2:
						print(f"Blue {x}")
						print(f"Red {x}")
					else:	
						print(f"Red {x}")
						print(f"Blue {x}")
				i+=1
		else:
			#全て食べることができない
			print("No")
		
0