목차

특별상 눈치게임

ps
링크acmicpc.net/…
출처BOJ
문제 번호33911
문제명특별상 눈치게임
레벨실버 3
분류

수학

시간복잡도O(n+m)
인풋사이즈n<=100, m<=100
사용한 언어Python 3.13
제출기록34536KB / 36ms
최고기록36ms
해결날짜2025/05/23

풀이

코드

"""Solution code for "BOJ 33911. 특별상 눈치게임".

- Problem link: https://www.acmicpc.net/problem/33911
- Solution link: http://www.teferi.net/ps/problems/boj/33911

Tags: [ad hoc]
"""

import math


def main():
    N = int(input())
    counter = [0] * 101
    for _ in range(N):
        A, B, C = [int(x) for x in input().split()]
        counter[A] += 1
        counter[B] += 1
        counter[C] += 1

    answer = 0
    cannot_select_count = must_select_count = 0
    for i in range(100, 0, -1):
        if counter[i] == 0:            
            answer += math.comb(
                99 - cannot_select_count - must_select_count,
                2 - must_select_count,
            )
            cannot_select_count += 1
        elif counter[i] == 1:
            must_select_count += 1
            if must_select_count >= 3:
                break

    print(answer)


if __name__ == '__main__':
    main()