結果
| 問題 |
No.2148 ひとりUNO
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-06-20 12:27:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,182 bytes |
| コンパイル時間 | 193 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 77,184 KB |
| 最終ジャッジ日時 | 2024-06-27 23:29:28 |
| 合計ジャッジ時間 | 6,544 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 WA * 37 |
ソースコード
import sys
input = sys.stdin.readline
def f(c):
if c == "R":
return 0
elif c == "G":
return 1
else:
return 2
T = int(input())
for _ in range(T):
N = int(input())
S = [set() for i in range(3)]
for i in range(N):
C, n = input().split()
n = int(n)
S[f(C)].add(n)
L = []
for i in range(3):
L.append((len(S[i]), S[i]))
L.sort(reverse=True)
S0, S1, S2 = L[0][1], L[1][1], L[2][1]
if len(S2) == 0 and len(S1) == 0:
print("YES")
continue
S01 = S1.intersection(S0)
S02 = S2.intersection(S0)
S12 = S1.intersection(S2)
if len(S2) == 0 and S01:
print("YES")
continue
if len(S01) >= 2 and (S02 or S12):
print("YES")
continue
if len(S02) >= 2 and (S01 or S12):
print("YES")
continue
if len(S12) >= 2 and (S02 or S01):
print("YES")
continue
if S01 and S12 and len(S[1]) == 1:
print("YES")
continue
if S02 and S12 and len(S[2]) == 1:
print("YES")
continue
if S01 and S02 and len(S[0]) == 1:
print("YES")
continue
print("NO")
rlangevin