传统题 1700ms 256MiB

2024夏-A-3 Dominant Set

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

题目描述

In graph theory, a dominant set for an undirected graph G=(V,E)G = (V, E) is a subset DD of VV such that every vertex not in DD is adjacent to at least one member of DD. 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: nn (104\le 10^4), the number of vertices; and mm (105\le 10^5), the number of edges. Then mm lines follow, each gives indices of the two ends of an edge. The vertices are indexed from 1 to nn. Then a positive integer KK (103\le 10^3) is given, followed by KK 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

PAT2024夏季重现赛

未参加
状态
已结束
规则
IOI
题目
11
开始于
2025-8-10 14:00
结束于
2025-8-10 17:30
持续时间
3.5 小时
主持人
参赛人数
37