Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. from typing import *
  2. n = int(input())
  3. possible = set(i + 1 for i in range(n)) # type: Set[int]
  4. previous = "" # type: Any
  5. current = "" # type: Any
  6. while current != "HELP":
  7. current = input()
  8. if current == "YES":
  9. possible = possible.intersection(set(map(int, previous.split())))
  10. elif current == "NO":
  11. possible -= set((map(int, previous.split())))
  12. previous = current
  13. print(*sorted(possible))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement