#include<bits/stdc++.h>
typedef long long ll;
const ll mod = (ll) 1e9 + 7;
const ll mx = (ll) 1e5 +7;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,k,ans=0;
cin>>n>>k;
vector<vector<ll>>v(n);
map<pair<ll,ll>,ll>m;
bool r=0;
for(int i=0; i<n; i++)
{
ll a;
cin>>a;
for(int j=0; j<a; j++)
{
ll b;
cin>>b;
v[i].push_back(b);
v[b].push_back(i);
m[ {i,b}]=1;
m[ {b,i}]=1;
ans=2;
r=1;
}
}
if(k==1)ans=1;
if(k==2&&r==1)ans=2;
else if(r==0&&k==2)ans=1;
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
7 ms |
1228 KB |
Output is correct |
4 |
Correct |
6 ms |
1356 KB |
Output is correct |
5 |
Correct |
8 ms |
1340 KB |
Output is correct |
6 |
Correct |
7 ms |
1348 KB |
Output is correct |
7 |
Correct |
7 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
7 ms |
1228 KB |
Output is correct |
4 |
Correct |
6 ms |
1356 KB |
Output is correct |
5 |
Correct |
8 ms |
1340 KB |
Output is correct |
6 |
Correct |
7 ms |
1348 KB |
Output is correct |
7 |
Correct |
7 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
6 ms |
1356 KB |
Output is correct |
12 |
Correct |
6 ms |
1356 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
6 ms |
1356 KB |
Output is correct |
15 |
Incorrect |
0 ms |
312 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
7 ms |
1228 KB |
Output is correct |
4 |
Correct |
6 ms |
1356 KB |
Output is correct |
5 |
Correct |
8 ms |
1340 KB |
Output is correct |
6 |
Correct |
7 ms |
1348 KB |
Output is correct |
7 |
Correct |
7 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
6 ms |
1356 KB |
Output is correct |
12 |
Correct |
6 ms |
1356 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
6 ms |
1356 KB |
Output is correct |
15 |
Incorrect |
0 ms |
312 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
7 ms |
1228 KB |
Output is correct |
4 |
Correct |
6 ms |
1356 KB |
Output is correct |
5 |
Correct |
8 ms |
1340 KB |
Output is correct |
6 |
Correct |
7 ms |
1348 KB |
Output is correct |
7 |
Correct |
7 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
6 ms |
1356 KB |
Output is correct |
12 |
Correct |
6 ms |
1356 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
6 ms |
1356 KB |
Output is correct |
15 |
Incorrect |
0 ms |
312 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |