https://www.acmicpc.net/problem/16960
코드
from collections import defaultdict
n, m = map(int, input().split())
lamp_count = defaultdict(int)
switch_lamp = []
for _ in range(n):
num, *arr = list(map(int, input().split()))
switch_lamp.append(arr)
for a in arr:
lamp_count[a] += 1
for i in range(n):
possible = True
for lamp in switch_lamp[i]:
if lamp_count[lamp] == 1:
possible = False
break
if possible:
print(1)
exit()
print(0)
'문제풀이 > 구현' 카테고리의 다른 글
[Python/파이썬] 백준 15683번 감시 (0) | 2025.01.07 |
---|---|
[Javascript/자바스크립트 ] (프로그래머스) [1차] 뉴스 클러스터링 (0) | 2024.12.21 |
[Javascript/자바스크립트] 프로그래머스 최댓값과 최솟값 (0) | 2024.06.21 |
[Python/파이썬] 백준 2628번 종이자르기 (0) | 2024.05.13 |
[Python/파이썬] 백준 20665번 독서실 거리두기 (0) | 2024.05.10 |