結果

問題 No.2148 ひとりUNO
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-12-07 19:52:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 992 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 77,184 KB
最終ジャッジ日時 2024-04-22 01:48:31
合計ジャッジ時間 4,712 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,584 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 104 ms
76,672 KB
testcase_17 AC 109 ms
76,596 KB
testcase_18 AC 101 ms
76,544 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 105 ms
76,540 KB
testcase_22 AC 102 ms
76,544 KB
testcase_23 AC 111 ms
76,416 KB
testcase_24 AC 103 ms
76,596 KB
testcase_25 AC 102 ms
76,764 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 36 ms
51,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from sys import stdin

CtoI = {}
CtoI["B"] = 0
CtoI["G"] = 1
CtoI["R"] = 2


TT = int(stdin.readline())
ANS = []

for loop in range(TT):

    N = int(stdin.readline())
    DC = {}
    cset = set()

    for i in range(N):

        C,D = stdin.readline()[:-1].split()

        if D not in DC:
            DC[D] = [0,0,0]
            
        DC[D][CtoI[C]] = 1 

        cset.add(C)

    same = [0] * 3

    for D in DC:

        bgr = DC[D]

        if bgr[0] == bgr[1] == 1:
            same[0] = 1
        if bgr[1] == bgr[2] == 1:
            same[1] = 1
        if bgr[2] == bgr[0] == 1:
            same[2] = 1

    #print (cset,same)

    if len(cset) == 1:
        ANS.append("YES")
    elif len(cset) == 2:
        if sum(same) > 0:
            ANS.append("YES")
        else:
            ANS.append("NO")
    else:
        if sum(same) >= 2:
            ANS.append("YES")
        else:
            ANS.append("NO")

print(*ANS, sep="\n")
# print ("\n".join(map(str,ANS)))
0