Vertex covers
Time limit3sMemory limit512 MB
For each query with n vertices and k, count simple graphs whose minimum vertex cover has size exactly k, printed modulo 2.
- Level
Hard8 of 10
- Topics
- Combinatorics, Math, Bit manipulation
- Solved
- No attempts yet
Problem
A vertex cover of an undirected simple graph is a subset such that for every we have or . The size of a vertex cover is .
Find the number of simple graphs with vertices whose smallest vertex cover has size exactly .
Two graphs and are different if and only if there exist two vertices () such that the edge belongs to exactly one of the sets and .
Since the answer can be very large, it suffices to print it modulo .
Input
The first line contains an integer (), the number of queries. Each of the following lines contains two integers and (, ), where is the number of vertices of () and is the desired size of the smallest vertex cover.
Output
Print lines. The -th line contains the answer to the -th query, either or .
Hints
In the first query has size . The simple graphs on whose smallest vertex cover has size are exactly the graphs with one or two edges. There are six of them.
In the second query, a graph on vertices whose smallest vertex cover has size must be a clique.