//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ve vector
typedef long long ll;
int n, k, r;
ve<set<int>> G;
ve<int> S;
void f(int i, int s) {
bool valid;
if (i < k) {
for (int j = s; j < n; j++) {
valid = true;
for (int l : S) {
if (G[l].find(j) == G[l].end() || G[j].find(l) == G[j].end()) {
valid = false;
break;
}
}
if (valid) {
S.push_back(j);
r = max(r, i + 1);
f(i + 1, j + 1);
S.pop_back();
}
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int d, a;
cin >> n >> k;
G = ve<set<int>>(n);
for (int i = 0; i < n; i++) {
cin >> d;
for (int j = 0; j < d; j++) {
cin >> a;
G[i].insert(a);
}
}
r = 0;
f(0, 0);
cout << r << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
57 ms |
1024 KB |
Output is correct |
4 |
Correct |
53 ms |
1024 KB |
Output is correct |
5 |
Correct |
54 ms |
1144 KB |
Output is correct |
6 |
Correct |
54 ms |
1024 KB |
Output is correct |
7 |
Correct |
53 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
640 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
45 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
57 ms |
1024 KB |
Output is correct |
4 |
Correct |
53 ms |
1024 KB |
Output is correct |
5 |
Correct |
54 ms |
1144 KB |
Output is correct |
6 |
Correct |
54 ms |
1024 KB |
Output is correct |
7 |
Correct |
53 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
640 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
45 ms |
760 KB |
Output is correct |
11 |
Correct |
52 ms |
1152 KB |
Output is correct |
12 |
Correct |
428 ms |
1272 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
187 ms |
1248 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
102 ms |
1152 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
107 ms |
1152 KB |
Output is correct |
19 |
Correct |
45 ms |
760 KB |
Output is correct |
20 |
Correct |
62 ms |
896 KB |
Output is correct |
21 |
Correct |
64 ms |
896 KB |
Output is correct |
22 |
Correct |
47 ms |
640 KB |
Output is correct |
23 |
Correct |
103 ms |
1280 KB |
Output is correct |
24 |
Correct |
44 ms |
640 KB |
Output is correct |
25 |
Correct |
103 ms |
1292 KB |
Output is correct |
26 |
Correct |
100 ms |
1260 KB |
Output is correct |
27 |
Correct |
90 ms |
1152 KB |
Output is correct |
28 |
Correct |
96 ms |
1152 KB |
Output is correct |
29 |
Correct |
109 ms |
1152 KB |
Output is correct |
30 |
Correct |
251 ms |
1280 KB |
Output is correct |
31 |
Correct |
128 ms |
1280 KB |
Output is correct |
32 |
Correct |
318 ms |
1280 KB |
Output is correct |
33 |
Correct |
103 ms |
1280 KB |
Output is correct |
34 |
Correct |
106 ms |
1380 KB |
Output is correct |
35 |
Correct |
31 ms |
768 KB |
Output is correct |
36 |
Correct |
29 ms |
768 KB |
Output is correct |
37 |
Correct |
31 ms |
768 KB |
Output is correct |
38 |
Correct |
15 ms |
640 KB |
Output is correct |
39 |
Correct |
16 ms |
640 KB |
Output is correct |
40 |
Correct |
147 ms |
1672 KB |
Output is correct |
41 |
Correct |
15 ms |
640 KB |
Output is correct |
42 |
Correct |
151 ms |
1784 KB |
Output is correct |
43 |
Correct |
148 ms |
1784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
640 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
512 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Execution timed out |
3086 ms |
26488 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
57 ms |
1024 KB |
Output is correct |
4 |
Correct |
53 ms |
1024 KB |
Output is correct |
5 |
Correct |
54 ms |
1144 KB |
Output is correct |
6 |
Correct |
54 ms |
1024 KB |
Output is correct |
7 |
Correct |
53 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
640 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
45 ms |
760 KB |
Output is correct |
11 |
Correct |
52 ms |
1152 KB |
Output is correct |
12 |
Correct |
428 ms |
1272 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
187 ms |
1248 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
102 ms |
1152 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
107 ms |
1152 KB |
Output is correct |
19 |
Correct |
45 ms |
760 KB |
Output is correct |
20 |
Correct |
62 ms |
896 KB |
Output is correct |
21 |
Correct |
64 ms |
896 KB |
Output is correct |
22 |
Correct |
47 ms |
640 KB |
Output is correct |
23 |
Correct |
103 ms |
1280 KB |
Output is correct |
24 |
Correct |
44 ms |
640 KB |
Output is correct |
25 |
Correct |
103 ms |
1292 KB |
Output is correct |
26 |
Correct |
100 ms |
1260 KB |
Output is correct |
27 |
Correct |
90 ms |
1152 KB |
Output is correct |
28 |
Correct |
96 ms |
1152 KB |
Output is correct |
29 |
Correct |
109 ms |
1152 KB |
Output is correct |
30 |
Correct |
251 ms |
1280 KB |
Output is correct |
31 |
Correct |
128 ms |
1280 KB |
Output is correct |
32 |
Correct |
318 ms |
1280 KB |
Output is correct |
33 |
Correct |
103 ms |
1280 KB |
Output is correct |
34 |
Correct |
106 ms |
1380 KB |
Output is correct |
35 |
Correct |
31 ms |
768 KB |
Output is correct |
36 |
Correct |
29 ms |
768 KB |
Output is correct |
37 |
Correct |
31 ms |
768 KB |
Output is correct |
38 |
Correct |
15 ms |
640 KB |
Output is correct |
39 |
Correct |
16 ms |
640 KB |
Output is correct |
40 |
Correct |
147 ms |
1672 KB |
Output is correct |
41 |
Correct |
15 ms |
640 KB |
Output is correct |
42 |
Correct |
151 ms |
1784 KB |
Output is correct |
43 |
Correct |
148 ms |
1784 KB |
Output is correct |
44 |
Correct |
1516 ms |
2712 KB |
Output is correct |
45 |
Correct |
5 ms |
384 KB |
Output is correct |
46 |
Correct |
166 ms |
1664 KB |
Output is correct |
47 |
Correct |
275 ms |
2808 KB |
Output is correct |
48 |
Correct |
149 ms |
1664 KB |
Output is correct |
49 |
Correct |
277 ms |
2688 KB |
Output is correct |
50 |
Correct |
282 ms |
2680 KB |
Output is correct |
51 |
Correct |
627 ms |
4732 KB |
Output is correct |
52 |
Correct |
51 ms |
1272 KB |
Output is correct |
53 |
Execution timed out |
3081 ms |
5248 KB |
Time limit exceeded |
54 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
57 ms |
1024 KB |
Output is correct |
4 |
Correct |
53 ms |
1024 KB |
Output is correct |
5 |
Correct |
54 ms |
1144 KB |
Output is correct |
6 |
Correct |
54 ms |
1024 KB |
Output is correct |
7 |
Correct |
53 ms |
1024 KB |
Output is correct |
8 |
Correct |
44 ms |
640 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
45 ms |
760 KB |
Output is correct |
11 |
Correct |
52 ms |
1152 KB |
Output is correct |
12 |
Correct |
428 ms |
1272 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
187 ms |
1248 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
102 ms |
1152 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
107 ms |
1152 KB |
Output is correct |
19 |
Correct |
45 ms |
760 KB |
Output is correct |
20 |
Correct |
62 ms |
896 KB |
Output is correct |
21 |
Correct |
64 ms |
896 KB |
Output is correct |
22 |
Correct |
47 ms |
640 KB |
Output is correct |
23 |
Correct |
103 ms |
1280 KB |
Output is correct |
24 |
Correct |
44 ms |
640 KB |
Output is correct |
25 |
Correct |
103 ms |
1292 KB |
Output is correct |
26 |
Correct |
100 ms |
1260 KB |
Output is correct |
27 |
Correct |
90 ms |
1152 KB |
Output is correct |
28 |
Correct |
96 ms |
1152 KB |
Output is correct |
29 |
Correct |
109 ms |
1152 KB |
Output is correct |
30 |
Correct |
251 ms |
1280 KB |
Output is correct |
31 |
Correct |
128 ms |
1280 KB |
Output is correct |
32 |
Correct |
318 ms |
1280 KB |
Output is correct |
33 |
Correct |
103 ms |
1280 KB |
Output is correct |
34 |
Correct |
106 ms |
1380 KB |
Output is correct |
35 |
Correct |
31 ms |
768 KB |
Output is correct |
36 |
Correct |
29 ms |
768 KB |
Output is correct |
37 |
Correct |
31 ms |
768 KB |
Output is correct |
38 |
Correct |
15 ms |
640 KB |
Output is correct |
39 |
Correct |
16 ms |
640 KB |
Output is correct |
40 |
Correct |
147 ms |
1672 KB |
Output is correct |
41 |
Correct |
15 ms |
640 KB |
Output is correct |
42 |
Correct |
151 ms |
1784 KB |
Output is correct |
43 |
Correct |
148 ms |
1784 KB |
Output is correct |
44 |
Correct |
6 ms |
384 KB |
Output is correct |
45 |
Execution timed out |
3081 ms |
18528 KB |
Time limit exceeded |
46 |
Halted |
0 ms |
0 KB |
- |