#include <stdio.h>
#include <string.h>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
vector<int> V[10010];
bool harsh[10010];
int N,M,K;
int main()
{
scanf("%d%d",&N,&M);
for(int i=0;i<M;i++)
{
int v1,v2;
scanf("%d%d",&v1,&v2);
V[v1].push_back(i);
V[v2].push_back(i);
}
scanf("%d",&K);
for(int i=0;i<K;i++)
{
memset(harsh,false,sizeof(harsh));
int num;
scanf("%d",&num);
for(int j=0;j<num;j++)
{
int v;
scanf("%d",&v);
for(int k=0;k<V[v].size();k++)
{
harsh[V[v][k]]=true;
}
}
bool flag=true;
for(int j=0;j<M;j++)
{
if(harsh[j]==false)
{
flag=false;
}
}
if(flag)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}
PAT甲1134 Vertex Cover(25 分)
最新推荐文章于 2023-05-24 17:59:38 发布