##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
You've handled linear, 2D, and tree states. Bitmask DP tracks which elements you've used in a subset.
Classic TSP variant using BFS with bitmask
Combines probability with bitmask DP elegantly
Concrete usage
Covered with full walkthrough in this section.
Covered with full walkthrough in this section.
Covered with full walkthrough in this section.
Covered with full walkthrough in this section.
Covered with full walkthrough in this section.
Covered with full walkthrough in this section.
Covered with full walkthrough in this section.
Classic bitmask DP with primes. Track which primes are used to ensure coprimality.
Choose k dishes with satisfaction bonuses. TSP variant with subset selection.
Find minimum subset with GCD 1. Inclusion-exclusion with bitmask over prime factors.
Find pair with AND = 0. SOS DP to propagate answers through submasks.
Maximize a[i] OR (a[j] AND a[k]). SOS DP tracking two rightmost indices per mask.
Remove minimum chars to avoid x-prime substrings. Aho-Corasick + bitmask DP.
Partition tasks into sessions. Bitmask DP tracking remaining time per session.
Assign hats to people uniquely. Bitmask over people, iterate over hats.
Connect all points in both groups. Bitmask DP over second group connections.
TSP on strings - minimize total length. Classic bitmask DP with path reconstruction.
Count perfect matchings using bitmask DP - classic application of subset enumeration.
Partition into groups maximizing total score - subset DP iterating over all submasks.
Count permutations satisfying < or > constraints - teaches insertion DP pattern.