내 풀이. dfs 조합으로 무식하게 풀었다. import sys input = sys.stdin.readline def dfs(s,cnt): global ans if cnt==3: ans += 1 return if cnt > 3: return for next in range(s+1,N+1): if not eat[next] and next not in donot_list: eat[next] = True for hate in ice_cream[next]: donot_list.append(hate) dfs(next, cnt + 1) eat[next] = False for hate in ice_cream[next]: donot_list.pop() N, M = map(int, input().split()) ice..