Ultraviolet A 11825 Hackers & amp; #39; Crackdown (pressure dp, subset enumeration)

Source: Internet
Author: User

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 <
   
    


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.