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()