#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <memory.h>
#include <set>
using namespace std;
#define rep(i, n) for(int i =0;i<(n);i++)
#define per(i, n) for (int i=((int)n-1);i>=0;i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define make_unique(x) { sort(all(x)); x.resize(unique(x.begin(), x.end()) - x.begin()); }
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define add insert
#define debug(x) { cerr << #x << "= " << x << "\n"; }
typedef long long ll;
typedef vector<int>vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
const int N = 50000;
set<int> g[N];
int max_click(vi v) {
int res = 0;
for (int mask = 1; mask < (1 << sz(v)); mask++) {
vi u;
rep(i, sz(v)) {
if (mask & (1 << i)) {
u.pb(v[i]);
}
}
bool ok = true;
rep(i, sz(u)) {
for (int j = i + 1; j < sz(u); j++) {
if (g[u[i]].count(u[j]) == 0) {
ok = false;
}
}
}
if (ok) {
res = max(res, sz(u));
}
}
return res;
}
int main() {
int n, k;
cin >> n >> k;
rep(i, n) {
int d;
cin >> d;
rep(j, d) {
int x;
cin >> x;
g[i].add(x);
}
}
set<pii> bdeg;
rep(i, n) {
bdeg.add({ sz(g[i]), i });
}
int ans = 0;
while (sz(bdeg)) {
int v = bdeg.begin()->ss;
bdeg.erase(bdeg.begin());
vi cand;
for (int u : g[v]) {
cand.pb(u);
}
cand.pb(v);
ans = max(ans, max_click(cand));
for (int u : g[v]) {
bdeg.erase(mp(sz(g[u]), u));
g[u].erase(v);
bdeg.add(mp(sz(g[u]), u));
}
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2688 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
11 ms |
3436 KB |
Output is correct |
4 |
Correct |
12 ms |
3564 KB |
Output is correct |
5 |
Correct |
12 ms |
3564 KB |
Output is correct |
6 |
Correct |
9 ms |
3564 KB |
Output is correct |
7 |
Correct |
11 ms |
3456 KB |
Output is correct |
8 |
Correct |
5 ms |
2924 KB |
Output is correct |
9 |
Correct |
3 ms |
2668 KB |
Output is correct |
10 |
Correct |
5 ms |
2924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2688 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
11 ms |
3436 KB |
Output is correct |
4 |
Correct |
12 ms |
3564 KB |
Output is correct |
5 |
Correct |
12 ms |
3564 KB |
Output is correct |
6 |
Correct |
9 ms |
3564 KB |
Output is correct |
7 |
Correct |
11 ms |
3456 KB |
Output is correct |
8 |
Correct |
5 ms |
2924 KB |
Output is correct |
9 |
Correct |
3 ms |
2668 KB |
Output is correct |
10 |
Correct |
5 ms |
2924 KB |
Output is correct |
11 |
Correct |
11 ms |
3456 KB |
Output is correct |
12 |
Correct |
13 ms |
3436 KB |
Output is correct |
13 |
Correct |
3 ms |
2668 KB |
Output is correct |
14 |
Correct |
11 ms |
3436 KB |
Output is correct |
15 |
Correct |
3 ms |
2668 KB |
Output is correct |
16 |
Correct |
12 ms |
3436 KB |
Output is correct |
17 |
Correct |
2 ms |
2668 KB |
Output is correct |
18 |
Correct |
12 ms |
3436 KB |
Output is correct |
19 |
Correct |
5 ms |
2924 KB |
Output is correct |
20 |
Correct |
8 ms |
3180 KB |
Output is correct |
21 |
Correct |
8 ms |
3180 KB |
Output is correct |
22 |
Correct |
5 ms |
2924 KB |
Output is correct |
23 |
Correct |
13 ms |
3564 KB |
Output is correct |
24 |
Correct |
5 ms |
2924 KB |
Output is correct |
25 |
Correct |
13 ms |
3564 KB |
Output is correct |
26 |
Correct |
13 ms |
3436 KB |
Output is correct |
27 |
Correct |
10 ms |
3436 KB |
Output is correct |
28 |
Correct |
13 ms |
3436 KB |
Output is correct |
29 |
Correct |
11 ms |
3436 KB |
Output is correct |
30 |
Correct |
15 ms |
3564 KB |
Output is correct |
31 |
Correct |
14 ms |
3564 KB |
Output is correct |
32 |
Correct |
15 ms |
3564 KB |
Output is correct |
33 |
Correct |
14 ms |
3564 KB |
Output is correct |
34 |
Correct |
14 ms |
3564 KB |
Output is correct |
35 |
Correct |
8 ms |
3180 KB |
Output is correct |
36 |
Correct |
8 ms |
3180 KB |
Output is correct |
37 |
Correct |
8 ms |
3180 KB |
Output is correct |
38 |
Correct |
6 ms |
2924 KB |
Output is correct |
39 |
Correct |
6 ms |
2924 KB |
Output is correct |
40 |
Correct |
20 ms |
3948 KB |
Output is correct |
41 |
Correct |
8 ms |
2924 KB |
Output is correct |
42 |
Correct |
20 ms |
3948 KB |
Output is correct |
43 |
Correct |
20 ms |
3948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
2924 KB |
Output is correct |
2 |
Correct |
3 ms |
2668 KB |
Output is correct |
3 |
Correct |
3 ms |
2668 KB |
Output is correct |
4 |
Correct |
2 ms |
2668 KB |
Output is correct |
5 |
Correct |
3 ms |
2668 KB |
Output is correct |
6 |
Correct |
3 ms |
2668 KB |
Output is correct |
7 |
Correct |
3 ms |
2668 KB |
Output is correct |
8 |
Correct |
3 ms |
2668 KB |
Output is correct |
9 |
Correct |
3 ms |
2668 KB |
Output is correct |
10 |
Correct |
3 ms |
2668 KB |
Output is correct |
11 |
Correct |
1415 ms |
28780 KB |
Output is correct |
12 |
Correct |
2 ms |
2668 KB |
Output is correct |
13 |
Correct |
1430 ms |
28780 KB |
Output is correct |
14 |
Correct |
3 ms |
2668 KB |
Output is correct |
15 |
Correct |
1432 ms |
28780 KB |
Output is correct |
16 |
Correct |
1399 ms |
28908 KB |
Output is correct |
17 |
Correct |
1409 ms |
28840 KB |
Output is correct |
18 |
Correct |
1413 ms |
28908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2688 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
11 ms |
3436 KB |
Output is correct |
4 |
Correct |
12 ms |
3564 KB |
Output is correct |
5 |
Correct |
12 ms |
3564 KB |
Output is correct |
6 |
Correct |
9 ms |
3564 KB |
Output is correct |
7 |
Correct |
11 ms |
3456 KB |
Output is correct |
8 |
Correct |
5 ms |
2924 KB |
Output is correct |
9 |
Correct |
3 ms |
2668 KB |
Output is correct |
10 |
Correct |
5 ms |
2924 KB |
Output is correct |
11 |
Correct |
11 ms |
3456 KB |
Output is correct |
12 |
Correct |
13 ms |
3436 KB |
Output is correct |
13 |
Correct |
3 ms |
2668 KB |
Output is correct |
14 |
Correct |
11 ms |
3436 KB |
Output is correct |
15 |
Correct |
3 ms |
2668 KB |
Output is correct |
16 |
Correct |
12 ms |
3436 KB |
Output is correct |
17 |
Correct |
2 ms |
2668 KB |
Output is correct |
18 |
Correct |
12 ms |
3436 KB |
Output is correct |
19 |
Correct |
5 ms |
2924 KB |
Output is correct |
20 |
Correct |
8 ms |
3180 KB |
Output is correct |
21 |
Correct |
8 ms |
3180 KB |
Output is correct |
22 |
Correct |
5 ms |
2924 KB |
Output is correct |
23 |
Correct |
13 ms |
3564 KB |
Output is correct |
24 |
Correct |
5 ms |
2924 KB |
Output is correct |
25 |
Correct |
13 ms |
3564 KB |
Output is correct |
26 |
Correct |
13 ms |
3436 KB |
Output is correct |
27 |
Correct |
10 ms |
3436 KB |
Output is correct |
28 |
Correct |
13 ms |
3436 KB |
Output is correct |
29 |
Correct |
11 ms |
3436 KB |
Output is correct |
30 |
Correct |
15 ms |
3564 KB |
Output is correct |
31 |
Correct |
14 ms |
3564 KB |
Output is correct |
32 |
Correct |
15 ms |
3564 KB |
Output is correct |
33 |
Correct |
14 ms |
3564 KB |
Output is correct |
34 |
Correct |
14 ms |
3564 KB |
Output is correct |
35 |
Correct |
8 ms |
3180 KB |
Output is correct |
36 |
Correct |
8 ms |
3180 KB |
Output is correct |
37 |
Correct |
8 ms |
3180 KB |
Output is correct |
38 |
Correct |
6 ms |
2924 KB |
Output is correct |
39 |
Correct |
6 ms |
2924 KB |
Output is correct |
40 |
Correct |
20 ms |
3948 KB |
Output is correct |
41 |
Correct |
8 ms |
2924 KB |
Output is correct |
42 |
Correct |
20 ms |
3948 KB |
Output is correct |
43 |
Correct |
20 ms |
3948 KB |
Output is correct |
44 |
Correct |
165 ms |
4972 KB |
Output is correct |
45 |
Correct |
2 ms |
2668 KB |
Output is correct |
46 |
Correct |
21 ms |
3948 KB |
Output is correct |
47 |
Correct |
61 ms |
4972 KB |
Output is correct |
48 |
Correct |
21 ms |
3948 KB |
Output is correct |
49 |
Correct |
60 ms |
4972 KB |
Output is correct |
50 |
Correct |
69 ms |
4972 KB |
Output is correct |
51 |
Correct |
919 ms |
7096 KB |
Output is correct |
52 |
Correct |
11 ms |
3436 KB |
Output is correct |
53 |
Correct |
2646 ms |
7660 KB |
Output is correct |
54 |
Correct |
1929 ms |
7532 KB |
Output is correct |
55 |
Correct |
12 ms |
3436 KB |
Output is correct |
56 |
Correct |
11 ms |
3436 KB |
Output is correct |
57 |
Correct |
5 ms |
2924 KB |
Output is correct |
58 |
Correct |
2385 ms |
7660 KB |
Output is correct |
59 |
Correct |
21 ms |
3948 KB |
Output is correct |
60 |
Correct |
11 ms |
3436 KB |
Output is correct |
61 |
Correct |
21 ms |
3948 KB |
Output is correct |
62 |
Correct |
21 ms |
3948 KB |
Output is correct |
63 |
Correct |
165 ms |
5100 KB |
Output is correct |
64 |
Correct |
93 ms |
4716 KB |
Output is correct |
65 |
Correct |
19 ms |
3820 KB |
Output is correct |
66 |
Correct |
21 ms |
3948 KB |
Output is correct |
67 |
Correct |
161 ms |
5484 KB |
Output is correct |
68 |
Correct |
92 ms |
4736 KB |
Output is correct |
69 |
Correct |
18 ms |
3820 KB |
Output is correct |
70 |
Correct |
55 ms |
4716 KB |
Output is correct |
71 |
Correct |
156 ms |
5356 KB |
Output is correct |
72 |
Correct |
126 ms |
5228 KB |
Output is correct |
73 |
Correct |
11 ms |
3436 KB |
Output is correct |
74 |
Correct |
56 ms |
4844 KB |
Output is correct |
75 |
Correct |
125 ms |
5356 KB |
Output is correct |
76 |
Correct |
30 ms |
4332 KB |
Output is correct |
77 |
Correct |
319 ms |
5996 KB |
Output is correct |
78 |
Correct |
11 ms |
3436 KB |
Output is correct |
79 |
Correct |
156 ms |
4204 KB |
Output is correct |
80 |
Correct |
30 ms |
4332 KB |
Output is correct |
81 |
Correct |
320 ms |
5868 KB |
Output is correct |
82 |
Correct |
6 ms |
2924 KB |
Output is correct |
83 |
Correct |
162 ms |
4204 KB |
Output is correct |
84 |
Correct |
126 ms |
5228 KB |
Output is correct |
85 |
Correct |
7 ms |
2924 KB |
Output is correct |
86 |
Correct |
125 ms |
5228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2688 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
11 ms |
3436 KB |
Output is correct |
4 |
Correct |
12 ms |
3564 KB |
Output is correct |
5 |
Correct |
12 ms |
3564 KB |
Output is correct |
6 |
Correct |
9 ms |
3564 KB |
Output is correct |
7 |
Correct |
11 ms |
3456 KB |
Output is correct |
8 |
Correct |
5 ms |
2924 KB |
Output is correct |
9 |
Correct |
3 ms |
2668 KB |
Output is correct |
10 |
Correct |
5 ms |
2924 KB |
Output is correct |
11 |
Correct |
11 ms |
3456 KB |
Output is correct |
12 |
Correct |
13 ms |
3436 KB |
Output is correct |
13 |
Correct |
3 ms |
2668 KB |
Output is correct |
14 |
Correct |
11 ms |
3436 KB |
Output is correct |
15 |
Correct |
3 ms |
2668 KB |
Output is correct |
16 |
Correct |
12 ms |
3436 KB |
Output is correct |
17 |
Correct |
2 ms |
2668 KB |
Output is correct |
18 |
Correct |
12 ms |
3436 KB |
Output is correct |
19 |
Correct |
5 ms |
2924 KB |
Output is correct |
20 |
Correct |
8 ms |
3180 KB |
Output is correct |
21 |
Correct |
8 ms |
3180 KB |
Output is correct |
22 |
Correct |
5 ms |
2924 KB |
Output is correct |
23 |
Correct |
13 ms |
3564 KB |
Output is correct |
24 |
Correct |
5 ms |
2924 KB |
Output is correct |
25 |
Correct |
13 ms |
3564 KB |
Output is correct |
26 |
Correct |
13 ms |
3436 KB |
Output is correct |
27 |
Correct |
10 ms |
3436 KB |
Output is correct |
28 |
Correct |
13 ms |
3436 KB |
Output is correct |
29 |
Correct |
11 ms |
3436 KB |
Output is correct |
30 |
Correct |
15 ms |
3564 KB |
Output is correct |
31 |
Correct |
14 ms |
3564 KB |
Output is correct |
32 |
Correct |
15 ms |
3564 KB |
Output is correct |
33 |
Correct |
14 ms |
3564 KB |
Output is correct |
34 |
Correct |
14 ms |
3564 KB |
Output is correct |
35 |
Correct |
8 ms |
3180 KB |
Output is correct |
36 |
Correct |
8 ms |
3180 KB |
Output is correct |
37 |
Correct |
8 ms |
3180 KB |
Output is correct |
38 |
Correct |
6 ms |
2924 KB |
Output is correct |
39 |
Correct |
6 ms |
2924 KB |
Output is correct |
40 |
Correct |
20 ms |
3948 KB |
Output is correct |
41 |
Correct |
8 ms |
2924 KB |
Output is correct |
42 |
Correct |
20 ms |
3948 KB |
Output is correct |
43 |
Correct |
20 ms |
3948 KB |
Output is correct |
44 |
Correct |
3 ms |
2668 KB |
Output is correct |
45 |
Correct |
422 ms |
20844 KB |
Output is correct |
46 |
Correct |
165 ms |
13036 KB |
Output is correct |
47 |
Correct |
429 ms |
20972 KB |
Output is correct |
48 |
Correct |
423 ms |
20972 KB |
Output is correct |
49 |
Correct |
108 ms |
10348 KB |
Output is correct |
50 |
Correct |
618 ms |
26220 KB |
Output is correct |
51 |
Correct |
433 ms |
20844 KB |
Output is correct |
52 |
Correct |
109 ms |
10348 KB |
Output is correct |
53 |
Correct |
105 ms |
10348 KB |
Output is correct |
54 |
Correct |
29 ms |
5100 KB |
Output is correct |
55 |
Correct |
610 ms |
26220 KB |
Output is correct |
56 |
Correct |
68 ms |
7796 KB |
Output is correct |
57 |
Correct |
105 ms |
10348 KB |
Output is correct |
58 |
Correct |
151 ms |
13036 KB |
Output is correct |
59 |
Correct |
64 ms |
7788 KB |
Output is correct |
60 |
Correct |
67 ms |
7788 KB |
Output is correct |
61 |
Correct |
156 ms |
13036 KB |
Output is correct |
62 |
Correct |
108 ms |
10476 KB |
Output is correct |
63 |
Correct |
225 ms |
14444 KB |
Output is correct |
64 |
Correct |
65 ms |
7788 KB |
Output is correct |
65 |
Correct |
301 ms |
17132 KB |
Output is correct |
66 |
Correct |
111 ms |
10348 KB |
Output is correct |
67 |
Correct |
237 ms |
14316 KB |
Output is correct |
68 |
Correct |
272 ms |
16364 KB |
Output is correct |
69 |
Correct |
302 ms |
17004 KB |
Output is correct |
70 |
Correct |
111 ms |
10348 KB |
Output is correct |
71 |
Correct |
274 ms |
16364 KB |
Output is correct |
72 |
Correct |
203 ms |
13932 KB |
Output is correct |
73 |
Correct |
346 ms |
18796 KB |
Output is correct |
74 |
Correct |
108 ms |
10348 KB |
Output is correct |
75 |
Correct |
104 ms |
8940 KB |
Output is correct |
76 |
Correct |
201 ms |
13932 KB |
Output is correct |
77 |
Correct |
341 ms |
18656 KB |
Output is correct |
78 |
Correct |
168 ms |
10604 KB |
Output is correct |
79 |
Correct |
120 ms |
9068 KB |
Output is correct |
80 |
Correct |
49 ms |
5868 KB |
Output is correct |
81 |
Correct |
155 ms |
10604 KB |
Output is correct |
82 |
Correct |
242 ms |
15596 KB |
Output is correct |
83 |
Correct |
47 ms |
5868 KB |
Output is correct |
84 |
Correct |
242 ms |
15596 KB |
Output is correct |