Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = int(input())
- M = int(input())
- sizes = []
- for i in range(N):
- sizes.append(input())
- names = []
- for i in range(M):
- name = input().split()
- names.append((name[0], int(name[1])))
- #names = sorted(names, key=lambda x: x[1])
- #print(sizes, names)
- applied = {idx: 0 for idx, _ in enumerate(sizes)}
- for name in names:
- name_len = name[1]
- name_first = name[0]
- size = sizes[name_len - 1]
- if size == 'C' and (name_first == 'A' or name_first == 'B'):
- continue
- if size == 'B' and (name_first == 'A'):
- continue
- # name applied
- applied[name_len - 1] += 1
- counter = 0
- for idx, cnt in applied.items():
- if cnt == 1:
- counter += 1
- print(counter)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement