BOJ - 9375 - 패션왕 신해빈

Updated:

import sys
from collections import Counter

def solution():
    T = int(input())
    
    for i in range(T):
        S = []
        N = int(input())
        
        for j in range(N):
            A, B = map(str, sys.stdin.readline().split())
            S.append(B)
            
        num = 1
        result = Counter(S)

        for k in result:
            num *= result[k] + 1

        print(num - 1)

solution()

https://www.acmicpc.net/problem/9375

Categories:

Updated:

Leave a comment