Graph Theory37 sections · 1633 units
Open in Course

Problem - Giant Pizza

CSES 1684 - 2-SAT.

Problem: nn people are choosing toppings for a pizza. Each person specifies two topping preferences with conditions like "I want topping xx" or "I don't want topping yy". Each person must get at least one of their wishes. Can you satisfy everyone?

Link: CSES 1684

Constraints:

  • 1n1051 \leq n \leq 10^5 people
  • 1m1051 \leq m \leq 10^5 toppings

Output: A valid topping selection, or "IMPOSSIBLE".