NOBLE-_-MAN

5

Oct 26th, 2021 (edited)
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. def rec(st, i=0):
  2.     global c, n, m
  3.     if i == m:
  4.         c += 1
  5.         return
  6.     st0 = st + "0"
  7.     if st0 not in b:
  8.         rec(st0, i + 1)
  9.     st1 = st + "1"
  10.     if st1 not in b:
  11.         rec(st1, i + 1)
  12.  
  13.  
  14. n, m = map(int, input().split())
  15. b = set(e[:m] for e in input().split())
  16. # print(sorted(list(b)))
  17. c = 0
  18. rec("", 0)
  19. print(c)
  20.  
Add Comment
Please, Sign In to add comment