#P5871. [SEERC 2018] Inversion
[SEERC 2018] Inversion
Description
A permutation of length is defined as a sequence , where every integer in the range appears in this sequence exactly once. An inversion pair in a permutation is defined as a pair of integers , where , and it satisfies .
An inversion graph is defined as a graph with vertices, where an edge exists if and only if is an inversion pair.
An independent set in a graph is a set of vertices such that no two vertices in the set are connected by an edge. A dominating set in a graph is a set of vertices such that every vertex not in the set is adjacent to some vertex in the set. An independent dominating set in a graph is a set of vertices that is both an independent set and a dominating set.
Given the inversion graph of a permutation of length , compute the number of independent dominating sets in this graph.
It is guaranteed that the answer will not exceed .
Input Format
The first line contains two integers and $m \ (1 \leq n \leq 100, 0 \leq m \leq \frac{n \times (n-1)}{2})$, representing the number of vertices and the number of edges in the graph.
The next lines each contain two integers and , indicating that there is an edge between vertices and .
It is guaranteed that the graph corresponds to some permutation.
Output Format
Output the number of independent dominating sets in the graph.
It is guaranteed that the answer will not exceed .
4 2
2 3
2 4
2
5 7
2 5
1 5
3 5
2 3
4 1
4 3
4 2
3
7 7
5 6
2 3
6 7
2 7
3 1
7 5
7 4
6
5 6
1 3
4 5
1 4
2 3
1 2
1 5
5
Hint
In the first sample, the graph corresponds to the permutation , and the independent dominating sets are and .
In the second sample, the graph corresponds to the permutation , and the independent dominating sets are , , and .
In the third sample, the graph corresponds to the permutation .
In the fourth sample, the graph corresponds to the permutation .
Translated by ChatGPT 5
京公网安备 11011102002149号