結果

問題 No.2148 ひとりUNO
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-12-07 19:41:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 968 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2024-04-22 01:40:55
合計ジャッジ時間 5,930 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,352 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 137 ms
76,772 KB
testcase_17 AC 132 ms
76,372 KB
testcase_18 AC 132 ms
76,800 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 132 ms
76,620 KB
testcase_22 AC 137 ms
76,156 KB
testcase_23 AC 133 ms
76,972 KB
testcase_24 AC 134 ms
76,392 KB
testcase_25 AC 134 ms
76,744 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 39 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from sys import stdin

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

for loop in range(TT):

    N = int(stdin.readline())
    DC = []

    for i in range(N):

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

    DC.sort()

    cset = set()
    for i in range(N):
        cset.add(DC[i][1])

    same = [0] * 3

    for i in range(N-1):

        d1,c1 = DC[i]
        d2,c2 = DC[i+1]

        if d1 == d2:

            cs = (c1,c2)

            if "B" in cs and "G" in cs:
                same[0] = 1
            if "G" in cs and "R" in cs:
                same[1] = 1
            if "R" in cs and "B" in cs:
                same[2] = 1


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

print ("\n".join(ANS))
0