結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,828 KB
testcase_01 AC 16 ms
7,776 KB
testcase_02 AC 204 ms
8,192 KB
testcase_03 AC 160 ms
10,996 KB
testcase_04 AC 160 ms
11,132 KB
testcase_05 AC 156 ms
11,168 KB
testcase_06 AC 175 ms
11,504 KB
testcase_07 AC 135 ms
11,128 KB
testcase_08 AC 192 ms
22,812 KB
testcase_09 AC 183 ms
18,504 KB
testcase_10 AC 171 ms
25,980 KB
testcase_11 AC 228 ms
29,848 KB
testcase_12 AC 167 ms
24,348 KB
testcase_13 AC 275 ms
26,808 KB
testcase_14 AC 192 ms
24,888 KB
testcase_15 AC 159 ms
20,496 KB
testcase_16 AC 222 ms
20,776 KB
testcase_17 AC 192 ms
24,616 KB
testcase_18 AC 313 ms
33,848 KB
testcase_19 AC 341 ms
41,420 KB
testcase_20 AC 330 ms
46,004 KB
testcase_21 AC 334 ms
43,728 KB
testcase_22 AC 306 ms
31,864 KB
testcase_23 AC 338 ms
44,928 KB
testcase_24 AC 314 ms
32,776 KB
testcase_25 AC 316 ms
31,868 KB
testcase_26 AC 340 ms
45,900 KB
testcase_27 AC 311 ms
30,640 KB
testcase_28 AC 312 ms
33,920 KB
testcase_29 AC 314 ms
33,628 KB
testcase_30 AC 330 ms
35,840 KB
testcase_31 AC 343 ms
46,016 KB
testcase_32 AC 350 ms
46,016 KB
testcase_33 AC 328 ms
40,792 KB
testcase_34 AC 344 ms
42,264 KB
testcase_35 AC 331 ms
37,552 KB
testcase_36 AC 329 ms
40,696 KB
testcase_37 AC 313 ms
33,316 KB
testcase_38 AC 1,088 ms
8,160 KB
testcase_39 AC 1,202 ms
7,904 KB
testcase_40 AC 217 ms
8,560 KB
testcase_41 AC 257 ms
8,764 KB
testcase_42 AC 331 ms
41,844 KB
testcase_43 AC 325 ms
41,864 KB
testcase_44 AC 280 ms
40,220 KB
testcase_45 AC 288 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(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