結果
問題 | No.2148 ひとりUNO |
ユーザー | trineutron |
提出日時 | 2022-12-05 04:30:54 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 297 ms / 2,000 ms |
コード長 | 1,124 bytes |
コンパイル時間 | 150 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-04-20 08:13:45 |
合計ジャッジ時間 | 6,824 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
10,752 KB |
testcase_01 | AC | 52 ms
11,008 KB |
testcase_02 | AC | 50 ms
10,880 KB |
testcase_03 | AC | 51 ms
10,880 KB |
testcase_04 | AC | 51 ms
10,880 KB |
testcase_05 | AC | 54 ms
10,880 KB |
testcase_06 | AC | 55 ms
10,880 KB |
testcase_07 | AC | 53 ms
10,752 KB |
testcase_08 | AC | 55 ms
10,752 KB |
testcase_09 | AC | 55 ms
10,752 KB |
testcase_10 | AC | 55 ms
10,752 KB |
testcase_11 | AC | 56 ms
10,880 KB |
testcase_12 | AC | 55 ms
10,624 KB |
testcase_13 | AC | 53 ms
10,752 KB |
testcase_14 | AC | 54 ms
10,880 KB |
testcase_15 | AC | 54 ms
10,880 KB |
testcase_16 | AC | 290 ms
10,752 KB |
testcase_17 | AC | 289 ms
10,752 KB |
testcase_18 | AC | 286 ms
10,752 KB |
testcase_19 | AC | 297 ms
10,752 KB |
testcase_20 | AC | 289 ms
10,880 KB |
testcase_21 | AC | 281 ms
10,752 KB |
testcase_22 | AC | 271 ms
10,880 KB |
testcase_23 | AC | 277 ms
10,880 KB |
testcase_24 | AC | 276 ms
10,880 KB |
testcase_25 | AC | 291 ms
10,880 KB |
testcase_26 | AC | 130 ms
10,752 KB |
testcase_27 | AC | 124 ms
10,880 KB |
testcase_28 | AC | 124 ms
10,880 KB |
testcase_29 | AC | 126 ms
10,880 KB |
testcase_30 | AC | 120 ms
10,752 KB |
testcase_31 | AC | 124 ms
10,880 KB |
testcase_32 | AC | 127 ms
10,880 KB |
testcase_33 | AC | 129 ms
10,752 KB |
testcase_34 | AC | 128 ms
10,880 KB |
testcase_35 | AC | 120 ms
10,880 KB |
testcase_36 | AC | 124 ms
11,008 KB |
testcase_37 | AC | 116 ms
10,880 KB |
testcase_38 | AC | 120 ms
10,752 KB |
testcase_39 | AC | 28 ms
10,752 KB |
ソースコード
def solve(): n = int(input()) colors = [set() for _ in range(n)] for _ in range(n): c, d = input().split() d = int(d) d -= 1 colors[d].add(c) count_r = 0 count_g = 0 count_b = 0 rg = 0 gb = 0 br = 0 rgb = 0 for cs in colors: if 'R' in cs: count_r += 1 if 'G' in cs: count_g += 1 if 'B' in cs: count_b += 1 if cs == {'R', 'G'}: rg = 1 if cs == {'G', 'B'}: gb = 1 if cs == {'B', 'R'}: br = 1 if cs == {'R', 'G', 'B'}: rgb += 1 # 1 color if count_r + count_g == 0 or count_g + count_b == 0 or count_b + count_r == 0: return True # 2 colors if count_r == 0 or count_g == 0 or count_b == 0: return rg + gb + br > 0 # 3 colors if rg + gb + br + rgb >= 2: return True if rgb == 0: return False return count_r == 1 or count_g == 1 or count_b == 1 t = int(input()) for _ in range(t): if solve(): print('YES') else: print('NO')