여름의 서재
[백준] 5567_결혼식 본문
728x90
N = int(input())
n = int(input())
relationship = [list(map(int,input().split())) for _ in range(n)]
people = [i for i in range(1,N+1)]
friends = []
BF= []
for i in relationship:
if 1 in i:
BF += i
for i in relationship:
for j in BF:
if j in i:
friends +=i
print(len(set(friends))-1)
'알고리즘 > BOJ' 카테고리의 다른 글
[백준] 9095_1, 2, 3더하기 (0) | 2021.08.12 |
---|---|
[백준] 9012_괄호 (0) | 2021.08.12 |
[백준] 4949_균형잡힌 세상 (0) | 2021.08.12 |
[백준] 2630_색종이 만들기 (0) | 2021.08.12 |
[백준] 1992_쿼드트리 (0) | 2021.08.12 |
Comments