Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from typing import *
- n = int(input())
- possible = set(i + 1 for i in range(n)) # type: Set[int]
- previous = "" # type: Any
- current = "" # type: Any
- while current != "HELP":
- current = input()
- if current == "YES":
- possible = possible.intersection(set(map(int, previous.split())))
- elif current == "NO":
- possible -= set((map(int, previous.split())))
- previous = current
- print(*sorted(possible))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement