I cannot find an clear editorial about it. Can you help me with

How this DP works?

How to combine the answers(meet)?

# | User | Rating |
---|---|---|

1 | tourist | 3882 |

2 | maroonrk | 3539 |

3 | Benq | 3513 |

4 | MiracleFaFa | 3466 |

5 | ksun48 | 3462 |

6 | ecnerwala | 3446 |

7 | slime | 3428 |

8 | Um_nik | 3426 |

9 | jiangly | 3401 |

10 | greenheadstrange | 3393 |

# | User | Contrib. |
---|---|---|

1 | awoo | 191 |

1 | -is-this-fft- | 191 |

3 | Monogon | 184 |

4 | YouKn0wWho | 182 |

4 | Um_nik | 182 |

6 | maroonrk | 169 |

7 | antontrygubO_o | 167 |

8 | errorgorn | 165 |

8 | kostka | 165 |

10 | SecondThread | 164 |

I cannot find an clear editorial about it. Can you help me with

How this DP works?

How to combine the answers(meet)?

↑

↓

Codeforces (c) Copyright 2010-2022 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/22/2022 14:12:02 (g1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

Hello!

It may be fruitful to take a look at problem 1105E - Helping Hiasat . Also check out this comment.

Anyways, I will try to summarize the solution. First, observe you can reduce Max Independent Set to Max Clique by considering the complement graph. You then solve it using meet-in-the-middle. The main idea is to break the graph nodes into two halves and first find the max clique size for every subset of each half using DP.

Now, to "meet", you have to consider cliques which intersect both halves. The trick is to loop over all subsets of nodes in the second half (say we are currently considering $$$S_2$$$). If $$$S_2$$$ is not a clique, ignore it. Otherwise, construct the set $$$S_1$$$ of all nodes of the first half which have edges to all the nodes in $$$S_2$$$ (so that together they still form a clique shared by both halves). Since you have already precomputed the size of the max clique existing in $$$S_1$$$ using DP, you know that the "meeting" answer is $$$dp[S_1] + |S_2|$$$. Then you simply take the maximum over all the subsets you considered. The problem you linked to also asks for the actual nodes in a maximum independent set, but this is just a matter of reconstructing the solution (say, save the actual subsets instead of their sizes).

Overall it will take $$$O(2^{n/2} \cdot n^2)$$$ or $$$O(2^{n/2} \cdot n)$$$, depending on the way you represent the graph (I advise you to implement neighbour lists as bitmasks).

Hope it helped!

Thank you very much! I'll check it out now.