結果
問題 | No.2307 [Cherry 5 th Tune *] Cool 46 |
ユーザー |
![]() |
提出日時 | 2023-05-19 23:15:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 718 ms / 2,000 ms |
コード長 | 1,191 bytes |
コンパイル時間 | 569 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 130,820 KB |
最終ジャッジ日時 | 2024-12-21 04:00:11 |
合計ジャッジ時間 | 33,445 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 46 |
ソースコード
# 貪欲法T = int(input())for t in range(T):N, M = map(int, input().split())A = set(map(int, input().split()))B = set(map(int, input().split()))A_solo = []double = []for a in A:if a in B:double.append(a)else:A_solo.append(a)B_solo = []for b in B:if b not in A:B_solo.append(b)if N == 0 and M > 0:print('Yes')for b in B:print('Blue', b)elif M == 0 and N > 0:print('Yes')for a in A:print('Red', a)else:if len(double) == 0:print('No')else:print('Yes')double = sorted(list(double))for a in A_solo:print('Red', a)print('Red', double[0])print('Blue', double[0])for b in B_solo:print('Blue', b)for i in range(1, len(double)):if i%2 == 1:print('Blue', double[i])print('Red', double[i])else:print('Red', double[i])print('Blue', double[i])