結果

問題 No.2148 ひとりUNO
ユーザー ShirotsumeShirotsume
提出日時 2022-12-05 01:18:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 798 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 77,696 KB
最終ジャッジ日時 2024-04-20 06:07:38
合計ジャッジ時間 5,194 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 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 109 ms
76,700 KB
testcase_17 AC 115 ms
76,928 KB
testcase_18 AC 116 ms
76,936 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 117 ms
76,580 KB
testcase_22 AC 107 ms
76,820 KB
testcase_23 AC 105 ms
76,640 KB
testcase_24 AC 112 ms
76,908 KB
testcase_25 AC 112 ms
76,800 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 38 ms
53,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
sys.setrecursionlimit(5 * 10 ** 5)
from pypyjit import set_param
set_param('max_unroll_recursion=-1')
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

import itertools


def solve():
    n = ii()
    CD = [list(input().split()) for _ in range(n)]
    D = {}
    D['R'] = set()
    D['G'] = set()
    D['B'] = set()
    for i in range(n):
        c, d = CD[i]
        D[c].add(d)
    ans = 'NO'
    for v in itertools.permutations('RGB'):
        if (D[v[0]] & D[v[1]] and (D[v[1]] & D[v[2]] or not D[v[2]])) or (D[v[0]] and not D[v[1]] and not D[v[2]]):
            ans = 'YES'
    print(ans)

for _ in range(ii()):
    solve()
0