結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
ユーザー anonymouslyanonymously
提出日時 2023-05-19 22:30:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,228 ms / 2,000 ms
コード長 1,227 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 10,944 KB
実行使用メモリ 46,036 KB
最終ジャッジ日時 2023-08-23 03:44:00
合計ジャッジ時間 35,343 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,788 KB
testcase_01 AC 16 ms
7,776 KB
testcase_02 AC 208 ms
8,264 KB
testcase_03 AC 162 ms
10,856 KB
testcase_04 AC 159 ms
11,240 KB
testcase_05 AC 157 ms
10,992 KB
testcase_06 AC 165 ms
11,396 KB
testcase_07 AC 137 ms
11,104 KB
testcase_08 AC 188 ms
22,792 KB
testcase_09 AC 185 ms
18,408 KB
testcase_10 AC 169 ms
25,928 KB
testcase_11 AC 226 ms
29,860 KB
testcase_12 AC 171 ms
24,276 KB
testcase_13 AC 286 ms
26,972 KB
testcase_14 AC 190 ms
24,852 KB
testcase_15 AC 155 ms
20,324 KB
testcase_16 AC 222 ms
20,748 KB
testcase_17 AC 190 ms
24,556 KB
testcase_18 AC 308 ms
33,708 KB
testcase_19 AC 346 ms
41,484 KB
testcase_20 AC 335 ms
45,932 KB
testcase_21 AC 345 ms
43,696 KB
testcase_22 AC 312 ms
30,752 KB
testcase_23 AC 338 ms
45,088 KB
testcase_24 AC 308 ms
32,572 KB
testcase_25 AC 312 ms
32,944 KB
testcase_26 AC 331 ms
45,792 KB
testcase_27 AC 316 ms
30,696 KB
testcase_28 AC 317 ms
33,828 KB
testcase_29 AC 316 ms
33,468 KB
testcase_30 AC 335 ms
34,844 KB
testcase_31 AC 341 ms
45,932 KB
testcase_32 AC 340 ms
46,036 KB
testcase_33 AC 316 ms
40,704 KB
testcase_34 AC 348 ms
42,576 KB
testcase_35 AC 314 ms
37,480 KB
testcase_36 AC 320 ms
40,656 KB
testcase_37 AC 300 ms
33,248 KB
testcase_38 AC 1,126 ms
8,132 KB
testcase_39 AC 1,228 ms
8,256 KB
testcase_40 AC 219 ms
8,568 KB
testcase_41 AC 256 ms
8,736 KB
testcase_42 AC 335 ms
41,836 KB
testcase_43 AC 348 ms
41,964 KB
testcase_44 AC 282 ms
40,144 KB
testcase_45 AC 296 ms
40,048 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(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