AtCoder Beginner Contest 002 D – 派閥
import itertools
n , m = map(int,input().split())
r = []
for i in range(m):
r.append(set(map(int,input().split())))
chmax = 1
for i in range(2 ** n):
h = []
for j in range(n):
if (i >> j) & 1:
h.append(j + 1)
C=itertools.combinations(h,2)
ok = True
for c in C:
if set(c) not in r:
ok = False
break
if ok:
chmax = max(chmax,len(h))
print(chmax)
コメント