Inversion
Time limit1sMemory limit512 MB
Given the inversion graph of a permutation on at most 100 vertices, count its independent sets that also dominate every vertex outside. The answer fits in 10^18.
- Level
Hard8 of 10
- Topics
- Graph, Brute force, Backtracking, Bit manipulation
- Solved
- No attempts yet
Problem
A sequence is called a permutation of the numbers if every number in the range appears in it exactly once. A pair of integers with is called an inversion if and .
An inversion graph is a graph with exactly vertices in which there is an edge between the pair if and only if that pair is an inversion.
A set of vertices of a graph is called independent if no two vertices from this set have an edge between them. A set of vertices of a graph is called dominant if every vertex that does not belong to the set has an edge to at least one vertex that belongs to it. A set of vertices of a graph is called independent-dominant if it is both dominant and independent.
You are given the inversion graph of a particular permutation of , defined by the pairs of vertices that have an edge between them. Find the number of independent-dominant sets of the graph.
The answer is guaranteed not to exceed .
Input
The first line contains two integers and (, ), the number of vertices of the graph and the number of edges in the graph.
Each of the next lines contains two integers and (), which means that there is an edge between and .
It is guaranteed that there exists a permutation that gives this graph.
Output
Print the number of independent-dominant sets of vertices of the graph.
The answer is guaranteed not to exceed .
Notes
The first sample is the graph for permutation . We can select two sets of nodes: or .
The second sample is the graph for permutation . We can select three sets of nodes: , , .
The third sample is a graph for permutation .
The fourth sample is a graph for permutation .