Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rec(st, i=0):
- global c, n, m
- if i == m:
- c += 1
- return
- st0 = st + "0"
- if st0 not in b:
- rec(st0, i + 1)
- st1 = st + "1"
- if st1 not in b:
- rec(st1, i + 1)
- n, m = map(int, input().split())
- b = set(e[:m] for e in input().split())
- # print(sorted(list(b)))
- c = 0
- rec("", 0)
- print(c)
Add Comment
Please, Sign In to add comment