#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<set>
#include<queue>
#include<unordered_map>
using namespace std;
int G[200][200];
int main()
{
int n, m; int t1, t2;
cin >> n >> m;
for (int i = 0; i < m; i++)
{
cin >> t1 >> t2;
G[t1][t2] = 1;
G[t2][t1] = 1;
}
int k,nk; cin >> k;
vector<int>v;
for (int i = 0; i < k; i++)
{
cin >> nk;
v.clear(); int isClique = 1, Maximal = 1,hasht[201] = { 0 };
for (int i = 0; i < nk; i++)
{
cin >> t1;
v.push_back(t1);
hasht[v[i]] = 1;
}
for (int i = 0; i < nk; i++)
{
if (isClique == 0) break;
for (int j = i+1; j < nk; j++)
{
if (G[v[i]][v[j]] == 0)
{
isClique = 0;
cout << "Not a Clique" << endl;
break;
}
}
}
if (isClique == 0) continue;
for (int i = 1; i <= n; i++)
{
if (hasht[i] == 0)
{
for (int l = 0; l < nk; l++)
{
if (G[v[l]][i] == 0) break;
if (l == nk - 1)
{
Maximal = 0;
}
}
}
if (Maximal == 0)
{
cout << "Not Maximal" << endl;
break;
}
}
if(Maximal)
cout << "Yes" << endl;
}
return 0;
}
A1142 Maximal Clique[图模拟]
最新推荐文章于 2024-10-09 23:25:41 发布