-
Notifications
You must be signed in to change notification settings - Fork 0
/
1042.cpp
77 lines (71 loc) · 1.32 KB
/
1042.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int G[250][250];
const int INF = 1000000000;
int main(){
int nv, ne;
scanf("%d %d", &nv, &ne);
fill(G[0], G[0] + 250 * 250, INF);
for(int i = 0; i < ne; i++){
int u, v;
scanf("%d %d", &u, &v);
G[u][v] = 1;
G[v][u] = 1;
}
int m;
scanf("%d", &m);
for(int i = 0; i < m; i++){
int k;
scanf("%d", &k);
int temp;
bool Hash[250] = {false};
vector<int> st;
bool isclique = true;
for(int j = 0; j < k; j++){
scanf("%d", &temp);
Hash[temp] = true; //不能在这里判断,让他输入完!!!
/*
for(int l = 0; l < st.size(); l++){
if(G[st[l]][temp] != 1){
isclique = false;
break;
}
}
*/
st.push_back(temp);
}
for(int j = 0; j < k; j++){
for(int l = j + 1; l < k; l++){
if(G[st[j]][st[l]] != 1){
isclique = false;
break;
}
}
if(isclique == false){
printf("Not a Clique\n");
break;
}
}
if(isclique == false) continue;
bool isMaximal = true;
for(int j = 1; j <= nv; j++){
if(Hash[j] == true) continue;
for(int l = 0; l < st.size(); l++){
if(G[st[l]][j] != 1){
break;
}
if(l == st.size() - 1) isMaximal = false;
}
if(!isMaximal){
printf("Not Maximal\n");
break;
}
}
if(isMaximal){
printf("Yes\n");
}
}
return 0;
}