結果
問題 | No.2148 ひとりUNO |
ユーザー | Theta |
提出日時 | 2022-12-05 18:55:20 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 288 ms / 2,000 ms |
コード長 | 2,003 bytes |
コンパイル時間 | 90 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-10-12 15:56:25 |
合計ジャッジ時間 | 7,960 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
10,880 KB |
testcase_01 | AC | 62 ms
11,008 KB |
testcase_02 | AC | 63 ms
11,008 KB |
testcase_03 | AC | 64 ms
11,008 KB |
testcase_04 | AC | 62 ms
11,008 KB |
testcase_05 | AC | 62 ms
11,008 KB |
testcase_06 | AC | 62 ms
11,008 KB |
testcase_07 | AC | 66 ms
10,880 KB |
testcase_08 | AC | 62 ms
11,008 KB |
testcase_09 | AC | 63 ms
10,880 KB |
testcase_10 | AC | 63 ms
11,008 KB |
testcase_11 | AC | 62 ms
11,008 KB |
testcase_12 | AC | 62 ms
10,880 KB |
testcase_13 | AC | 62 ms
11,008 KB |
testcase_14 | AC | 62 ms
11,008 KB |
testcase_15 | AC | 62 ms
11,008 KB |
testcase_16 | AC | 283 ms
11,008 KB |
testcase_17 | AC | 286 ms
11,008 KB |
testcase_18 | AC | 288 ms
10,880 KB |
testcase_19 | AC | 287 ms
10,880 KB |
testcase_20 | AC | 276 ms
11,136 KB |
testcase_21 | AC | 281 ms
10,880 KB |
testcase_22 | AC | 280 ms
11,008 KB |
testcase_23 | AC | 280 ms
11,008 KB |
testcase_24 | AC | 277 ms
10,880 KB |
testcase_25 | AC | 279 ms
11,008 KB |
testcase_26 | AC | 130 ms
11,008 KB |
testcase_27 | AC | 132 ms
10,880 KB |
testcase_28 | AC | 132 ms
11,008 KB |
testcase_29 | AC | 134 ms
11,008 KB |
testcase_30 | AC | 131 ms
10,880 KB |
testcase_31 | AC | 131 ms
11,008 KB |
testcase_32 | AC | 129 ms
11,008 KB |
testcase_33 | AC | 133 ms
10,880 KB |
testcase_34 | AC | 131 ms
10,880 KB |
testcase_35 | AC | 132 ms
11,008 KB |
testcase_36 | AC | 128 ms
10,880 KB |
testcase_37 | AC | 129 ms
11,008 KB |
testcase_38 | AC | 130 ms
11,008 KB |
testcase_39 | AC | 30 ms
11,136 KB |
ソースコード
def main(): for _ in range(int(input())): N = int(input()) cards = [list(input().split()) for _ in range(N)] r_cards = filter(lambda card: card[0] == "R", cards) g_cards = filter(lambda card: card[0] == "G", cards) b_cards = filter(lambda card: card[0] == "B", cards) r_nums = set(map(lambda card: int(card[1]), r_cards)) g_nums = set(map(lambda card: int(card[1]), g_cards)) b_nums = set(map(lambda card: int(card[1]), b_cards)) rg_common = r_nums & g_nums gb_common = g_nums & b_nums br_common = b_nums & r_nums if max(map(len, (r_nums, b_nums, g_nums))) == sum(map(len, (r_nums, b_nums, g_nums))): print("YES") continue if len(tuple(filter(lambda elm: len(elm) >= 2, (rg_common, gb_common, br_common)))) >= 2: print("YES") continue if max(map(len, (rg_common, gb_common, br_common))) >= 2: if sum(map(len, (rg_common, gb_common, br_common))) - max(map(len, (rg_common, gb_common, br_common))) > 0: print("YES") elif min(map(len, (r_nums, b_nums, g_nums))) == 0: print("YES") else: print("NO") continue if max(map(len, (rg_common, gb_common, br_common))) == 1: if sum(map(len, (rg_common, gb_common, br_common))) == 3: if rg_common & gb_common: if all(len(nums) > 1 for nums in (r_nums, g_nums, b_nums)): print("NO") else: print("YES") else: print("YES") elif sum(map(len, (rg_common, gb_common, br_common))) == 2: print("YES") elif min(map(len, (r_nums, b_nums, g_nums))) == 0: print("YES") else: print("NO") continue print("NO") if __name__ == "__main__": main()