結果

問題 No.2148 ひとりUNO
ユーザー roarisroaris
提出日時 2022-12-05 05:47:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 77,568 KB
最終ジャッジ日時 2024-04-20 08:58:22
合計ジャッジ時間 5,496 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,760 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 124 ms
76,800 KB
testcase_17 AC 124 ms
77,012 KB
testcase_18 AC 121 ms
76,672 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 123 ms
76,980 KB
testcase_22 AC 125 ms
76,668 KB
testcase_23 AC 127 ms
76,660 KB
testcase_24 AC 125 ms
76,928 KB
testcase_25 AC 125 ms
76,760 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 42 ms
54,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

def f(c):
    if c=='R':
        return 0
    elif c=='G':
        return 1
    else:
        return 2

def solve():
    N = int(input())
    S = [set() for _ in range(3)]
    
    for i in range(N):
        C, D = input().split()
        S[f(C)].add(D)
    
    v, e = 0, 0
    
    for i in range(3):
        if len(S[i])>0:
            v += 1
    
        for j in range(i+1, 3):
            if len(S[i]&S[j])>0:
                e += 1
    
    if e>=v-1:
        print('YES')
    else:
        print('NO')

for _ in range(int(input())):
    solve()
0