Files
PAT/html/a1142.html
T

48 lines
1.6 KiB
HTML

<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<h1>1142. Maximal Clique (25)</h1>
<div id="problemContent">
<p>A <b>clique</b> is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A <b>maximal clique</b> is a clique that cannot be extended by including one more adjacent vertex. (Quoted from https://en.wikipedia.org/wiki/Clique_(graph_theory))
</p>
<p>
Now it is your job to judge if a given subset of vertices can form a maximal clique.
</p>
<p><b>
Input Specification:
</b></p>
<p>Each input file contains one test case. For each case, the first line gives two positive integers Nv (&lt;= 200), the number of vertices in the graph, and Ne, the number of undirected edges. Then Ne lines follow, each gives a pair of vertices of an edge. The vertices are numbered from 1 to Nv. </p>
<p>After the graph, there is another positive integer M (&lt;= 100). Then M lines of query follow, each first gives a positive number K (&lt;= Nv), then followed by a sequence of K distinct vertices. All the numbers in a line are separated by a space.
</p>
<p><b>
Output Specification:
</b></p>
<p>For each of the M queries, print in a line "Yes" if the given subset of vertices can form a maximal clique; or if it is a clique but not a <b>maximal clique</b>, print "Not Maximal"; or if it is not a clique at all, print "Not a Clique".</p>
<b>Sample Input:</b><pre>
8 10
5 6
7 8
6 4
3 6
4 5
2 3
8 2
2 7
5 3
3 4
6
4 5 4 3 6
3 2 8 7
2 2 3
1 1
3 4 3 6
3 3 2 1
</pre>
<b>Sample Output:</b><pre>
Yes
Yes
Yes
Yes
Not Maximal
Not a Clique
</pre>
</div>