#include<bits/stdc++.h>
using namespace std;
#define int long long
#define maxn 50050
int32_t main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int no_of_people,k;
int no_of_input1;
int input;
cin >> no_of_people >> k;
vector<unordered_set<int> > adj(maxn);
bool can2 = 0;
for(int i=0;i<no_of_people;i++){
cin >> no_of_input1;
for(int j=0;j<no_of_input1;j++){
can2 = 1;
cin >> input;
//cout << input << " ";
adj[i].insert(input);
}
//cout << "\n";
//cout << "-----------\n";
}
for(int i=0;i<no_of_people;i++){
for(auto l:adj[i]){
for(auto j:adj[l]){
//cout << i << " " << j << "--\n";
if(j!=i&&adj[i].count(j)!=0){
cout << min(k,(int)3);
return 0;
}
}
}
}
if(can2==1){
cout << min(k,(int)2);
}
else{
cout << min(k,(int)1);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
3072 KB |
Output is correct |
2 |
Correct |
6 ms |
3328 KB |
Output is correct |
3 |
Correct |
10 ms |
3584 KB |
Output is correct |
4 |
Correct |
290 ms |
3712 KB |
Output is correct |
5 |
Correct |
287 ms |
3712 KB |
Output is correct |
6 |
Correct |
14 ms |
3584 KB |
Output is correct |
7 |
Correct |
14 ms |
3712 KB |
Output is correct |
8 |
Correct |
6 ms |
3072 KB |
Output is correct |
9 |
Correct |
6 ms |
3072 KB |
Output is correct |
10 |
Correct |
7 ms |
3200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
3072 KB |
Output is correct |
2 |
Correct |
6 ms |
3328 KB |
Output is correct |
3 |
Correct |
10 ms |
3584 KB |
Output is correct |
4 |
Correct |
290 ms |
3712 KB |
Output is correct |
5 |
Correct |
287 ms |
3712 KB |
Output is correct |
6 |
Correct |
14 ms |
3584 KB |
Output is correct |
7 |
Correct |
14 ms |
3712 KB |
Output is correct |
8 |
Correct |
6 ms |
3072 KB |
Output is correct |
9 |
Correct |
6 ms |
3072 KB |
Output is correct |
10 |
Correct |
7 ms |
3200 KB |
Output is correct |
11 |
Correct |
288 ms |
3584 KB |
Output is correct |
12 |
Correct |
287 ms |
3584 KB |
Output is correct |
13 |
Correct |
6 ms |
3072 KB |
Output is correct |
14 |
Correct |
287 ms |
3712 KB |
Output is correct |
15 |
Correct |
6 ms |
3072 KB |
Output is correct |
16 |
Correct |
13 ms |
3712 KB |
Output is correct |
17 |
Correct |
6 ms |
3072 KB |
Output is correct |
18 |
Correct |
13 ms |
3712 KB |
Output is correct |
19 |
Correct |
7 ms |
3072 KB |
Output is correct |
20 |
Correct |
8 ms |
3456 KB |
Output is correct |
21 |
Correct |
8 ms |
3456 KB |
Output is correct |
22 |
Correct |
6 ms |
3072 KB |
Output is correct |
23 |
Correct |
10 ms |
3840 KB |
Output is correct |
24 |
Correct |
6 ms |
3072 KB |
Output is correct |
25 |
Correct |
10 ms |
3840 KB |
Output is correct |
26 |
Correct |
11 ms |
3712 KB |
Output is correct |
27 |
Correct |
9 ms |
3584 KB |
Output is correct |
28 |
Correct |
12 ms |
3712 KB |
Output is correct |
29 |
Correct |
10 ms |
3584 KB |
Output is correct |
30 |
Correct |
84 ms |
3840 KB |
Output is correct |
31 |
Correct |
10 ms |
3840 KB |
Output is correct |
32 |
Correct |
86 ms |
3840 KB |
Output is correct |
33 |
Correct |
11 ms |
3840 KB |
Output is correct |
34 |
Correct |
17 ms |
3840 KB |
Output is correct |
35 |
Correct |
8 ms |
3456 KB |
Output is correct |
36 |
Correct |
9 ms |
3456 KB |
Output is correct |
37 |
Correct |
9 ms |
3456 KB |
Output is correct |
38 |
Correct |
9 ms |
3328 KB |
Output is correct |
39 |
Correct |
9 ms |
3328 KB |
Output is correct |
40 |
Correct |
11 ms |
4096 KB |
Output is correct |
41 |
Correct |
10 ms |
3328 KB |
Output is correct |
42 |
Correct |
11 ms |
4096 KB |
Output is correct |
43 |
Correct |
11 ms |
4096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
3072 KB |
Output is correct |
2 |
Correct |
6 ms |
3072 KB |
Output is correct |
3 |
Correct |
6 ms |
3072 KB |
Output is correct |
4 |
Correct |
6 ms |
3072 KB |
Output is correct |
5 |
Incorrect |
6 ms |
3072 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
3072 KB |
Output is correct |
2 |
Correct |
6 ms |
3328 KB |
Output is correct |
3 |
Correct |
10 ms |
3584 KB |
Output is correct |
4 |
Correct |
290 ms |
3712 KB |
Output is correct |
5 |
Correct |
287 ms |
3712 KB |
Output is correct |
6 |
Correct |
14 ms |
3584 KB |
Output is correct |
7 |
Correct |
14 ms |
3712 KB |
Output is correct |
8 |
Correct |
6 ms |
3072 KB |
Output is correct |
9 |
Correct |
6 ms |
3072 KB |
Output is correct |
10 |
Correct |
7 ms |
3200 KB |
Output is correct |
11 |
Correct |
288 ms |
3584 KB |
Output is correct |
12 |
Correct |
287 ms |
3584 KB |
Output is correct |
13 |
Correct |
6 ms |
3072 KB |
Output is correct |
14 |
Correct |
287 ms |
3712 KB |
Output is correct |
15 |
Correct |
6 ms |
3072 KB |
Output is correct |
16 |
Correct |
13 ms |
3712 KB |
Output is correct |
17 |
Correct |
6 ms |
3072 KB |
Output is correct |
18 |
Correct |
13 ms |
3712 KB |
Output is correct |
19 |
Correct |
7 ms |
3072 KB |
Output is correct |
20 |
Correct |
8 ms |
3456 KB |
Output is correct |
21 |
Correct |
8 ms |
3456 KB |
Output is correct |
22 |
Correct |
6 ms |
3072 KB |
Output is correct |
23 |
Correct |
10 ms |
3840 KB |
Output is correct |
24 |
Correct |
6 ms |
3072 KB |
Output is correct |
25 |
Correct |
10 ms |
3840 KB |
Output is correct |
26 |
Correct |
11 ms |
3712 KB |
Output is correct |
27 |
Correct |
9 ms |
3584 KB |
Output is correct |
28 |
Correct |
12 ms |
3712 KB |
Output is correct |
29 |
Correct |
10 ms |
3584 KB |
Output is correct |
30 |
Correct |
84 ms |
3840 KB |
Output is correct |
31 |
Correct |
10 ms |
3840 KB |
Output is correct |
32 |
Correct |
86 ms |
3840 KB |
Output is correct |
33 |
Correct |
11 ms |
3840 KB |
Output is correct |
34 |
Correct |
17 ms |
3840 KB |
Output is correct |
35 |
Correct |
8 ms |
3456 KB |
Output is correct |
36 |
Correct |
9 ms |
3456 KB |
Output is correct |
37 |
Correct |
9 ms |
3456 KB |
Output is correct |
38 |
Correct |
9 ms |
3328 KB |
Output is correct |
39 |
Correct |
9 ms |
3328 KB |
Output is correct |
40 |
Correct |
11 ms |
4096 KB |
Output is correct |
41 |
Correct |
10 ms |
3328 KB |
Output is correct |
42 |
Correct |
11 ms |
4096 KB |
Output is correct |
43 |
Correct |
11 ms |
4096 KB |
Output is correct |
44 |
Incorrect |
16 ms |
5248 KB |
Output isn't correct |
45 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
3072 KB |
Output is correct |
2 |
Correct |
6 ms |
3328 KB |
Output is correct |
3 |
Correct |
10 ms |
3584 KB |
Output is correct |
4 |
Correct |
290 ms |
3712 KB |
Output is correct |
5 |
Correct |
287 ms |
3712 KB |
Output is correct |
6 |
Correct |
14 ms |
3584 KB |
Output is correct |
7 |
Correct |
14 ms |
3712 KB |
Output is correct |
8 |
Correct |
6 ms |
3072 KB |
Output is correct |
9 |
Correct |
6 ms |
3072 KB |
Output is correct |
10 |
Correct |
7 ms |
3200 KB |
Output is correct |
11 |
Correct |
288 ms |
3584 KB |
Output is correct |
12 |
Correct |
287 ms |
3584 KB |
Output is correct |
13 |
Correct |
6 ms |
3072 KB |
Output is correct |
14 |
Correct |
287 ms |
3712 KB |
Output is correct |
15 |
Correct |
6 ms |
3072 KB |
Output is correct |
16 |
Correct |
13 ms |
3712 KB |
Output is correct |
17 |
Correct |
6 ms |
3072 KB |
Output is correct |
18 |
Correct |
13 ms |
3712 KB |
Output is correct |
19 |
Correct |
7 ms |
3072 KB |
Output is correct |
20 |
Correct |
8 ms |
3456 KB |
Output is correct |
21 |
Correct |
8 ms |
3456 KB |
Output is correct |
22 |
Correct |
6 ms |
3072 KB |
Output is correct |
23 |
Correct |
10 ms |
3840 KB |
Output is correct |
24 |
Correct |
6 ms |
3072 KB |
Output is correct |
25 |
Correct |
10 ms |
3840 KB |
Output is correct |
26 |
Correct |
11 ms |
3712 KB |
Output is correct |
27 |
Correct |
9 ms |
3584 KB |
Output is correct |
28 |
Correct |
12 ms |
3712 KB |
Output is correct |
29 |
Correct |
10 ms |
3584 KB |
Output is correct |
30 |
Correct |
84 ms |
3840 KB |
Output is correct |
31 |
Correct |
10 ms |
3840 KB |
Output is correct |
32 |
Correct |
86 ms |
3840 KB |
Output is correct |
33 |
Correct |
11 ms |
3840 KB |
Output is correct |
34 |
Correct |
17 ms |
3840 KB |
Output is correct |
35 |
Correct |
8 ms |
3456 KB |
Output is correct |
36 |
Correct |
9 ms |
3456 KB |
Output is correct |
37 |
Correct |
9 ms |
3456 KB |
Output is correct |
38 |
Correct |
9 ms |
3328 KB |
Output is correct |
39 |
Correct |
9 ms |
3328 KB |
Output is correct |
40 |
Correct |
11 ms |
4096 KB |
Output is correct |
41 |
Correct |
10 ms |
3328 KB |
Output is correct |
42 |
Correct |
11 ms |
4096 KB |
Output is correct |
43 |
Correct |
11 ms |
4096 KB |
Output is correct |
44 |
Correct |
7 ms |
3072 KB |
Output is correct |
45 |
Incorrect |
91 ms |
18808 KB |
Output isn't correct |
46 |
Halted |
0 ms |
0 KB |
- |