2024夏-A-3 Dominant Set
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
题目描述
In graph theory, a dominant set for an undirected graph is a subset of such that every vertex not in is adjacent to at least one member of . Finding the minimum dominant set is an NP-hard problem. Your job is to verify, for a given graph, if a subset of vertices is a dominant set.
输入格式
Each input file contains one test case. For each case, the first line contains 2 positive integers: (), the number of vertices; and (), the number of edges. Then lines follow, each gives indices of the two ends of an edge. The vertices are indexed from 1 to . Then a positive integer () is given, followed by lines of vertex sets. Each set is given in the format:
k v[1] v[2] ... v[k]
where k
is the number of vertices in the set, and it is followed by k
distinct indices of vertices.
输出格式
For each given set, print in a line yes
if it is a dominant set, or no
if not.
样例
8 9
1 2
2 3
3 4
4 5
5 6
5 7
6 7
6 1
3 6
4
4 1 3 5 8
5 8 7 6 4 2
5 1 2 3 4 5
8 8 7 6 5 4 3 2 1
yes
yes
no
yes
限制
对于所有的测试用例,限制为1700 ms, 256 MB