結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー |
![]() |
提出日時 | 2023-05-19 23:56:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,467 ms / 2,000 ms |
コード長 | 2,672 bytes |
コンパイル時間 | 548 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 34,560 KB |
最終ジャッジ日時 | 2024-12-21 04:11:32 |
合計ジャッジ時間 | 37,541 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 46 |
ソースコード
#yukicoder389C'''■考察欄またカード食べてるよ・・・。Aiは赤のカード、Bjは青のカード。これら(N+M)枚のカードを全部食べたい。UNOの要領で食べてゆく。食べるたびに色が異なっていた回数が多いほどcool。全部食べろ。とりあえず同じ数字がなければ、全部食べることは不可能。一方、同じ数字が1個以上あれば全部食べられる。1 _ 2 3 _ _ 6 : 6から降順に食べて1 1 _ _ 4 5 _ : 1をまたいだら昇順に食べる。かっこよさは1。どうでもいいカードがなければ、かっこよさは2にできるのに。1 _ _ _ : 縮小版1 1 4 5 : 5,4,1,上1,1 と食べればかっこよさは2。ちょっと難しい。紙で実験しよう。Corner Case多すぎるだろ。これがyukicoder?1ケース落ちるんだが。どうせコーナーケースだろ。REなの納得いかないなぁ。なんでだ?原因不明すぎるので後回し。'''f=lambda:list(map(int,input().split()))nyu=int(input())for _ in range(nyu):N,M=f()if N==0:input(); B=f(); print('Yes')for i in B: print('Blue '+str(i))continueelif M==0:A=f(); input(); print('Yes')for i in A: print('Red '+str(i))continueA=f(); B=f(); P=set(A); matched=set()for i in B:if i in P: matched.add(i)if len(matched)==0: print('No'); continueelif len(matched)==1:print('Yes')if N==1:for i in B:if i not in matched: print('Blue '+str(i))for i in matched: print('Blue '+str(i)); print('Red '+str(i))continueelse:for i in A:if i not in matched: print('Red '+str(i))for i in matched: print('Red '+str(i)); print('Blue '+str(i))for i in B:if i not in matched: print('Blue '+str(i))continueelse:print('Yes')start=matched.pop(); print('Blue '+str(start)); print('Red '+str(start))for i in A:if i==start: continueif i not in matched: print('Red '+str(i))next=matched.pop(); print('Red '+str(next)); print('Blue '+str(next))for i in B:if i==start or i==next: continueif i not in matched: print('Blue '+str(i))next_is_BL = Truewhile len(matched):now=matched.pop()if next_is_BL==True: print('Blue '+str(now)); print('Red '+str(now)); next_is_BL=Falseelse: print('Red '+str(now)); print('Blue '+str(now)); next_is_BL=Trueprint()