Link to the question: Ultraviolet A 11825
Question:
You are a hacker and intrude into n computers (each computer has the same n types of services). For each computer, you can choose to terminate a service, the service is terminated. Your goal is to paralyze more services (without computers ).
Idea: (on page 70 of the big white, my equation is different from that on the big white page)
Divide n sets P1, P2, and Pn into as many groups as possible, so that the Union of all sets in each group is equal to the complete set. The set Pi here is the set of computer I and its adjacent computers, cover [I] indicates the union of all sets in the Set S of several Pi. dp [s] indicates the maximum number of groups that the subset s can be divided.
If cover [s] = all, dp [s] should be at least 1.
Dp [s] = max (dp [s], dp [s0] + dp [s ^ s0]); (sum of the two subsets)
Code:
# Include
# Include
# Include # define N 16 using namespace std; int n, m, x, dp [1 <