-
Notifications
You must be signed in to change notification settings - Fork 814
/
Copy path1166. Summit (25).cpp
47 lines (47 loc) · 1.21 KB
/
1166. Summit (25).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
#include <iostream>
#include <set>
using namespace std;
int n, m, k, l, u, v, s, e, f, f2, A[201][201];
int main() {
cin >> n >> m;
for (int i = 0; i < m; i++) {
cin >> u >> v;
A[u][v] = A[v][u] = 1;
}
cin >> k;
for (int i = 1; i <= k; i++) {
f = 0;
set<int> temp;
cin >> l;
for (int j = 0; j < l; j++) {
cin >> e;
for (auto it : temp)
if (!A[e][it]) f = 1;
temp.insert(e);
}
cout << "Area " << i;
if (f) {
cout << " needs help.\n";
} else {
for (int i = 1; i <= n; i++) {
f2 = 1;
if (temp.count(i)) continue;
for (auto it : temp) {
if (!A[i][it]) {
f2 = 0;
break;
}
}
if (f2) {
f = i;
break;
}
}
if (!f)
cout << " is OK.\n";
else
cout << " may invite more people, such as " << f << ".\n";
}
}
return 0;
}