///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define append push_back
#define add insert
#define nl "\n"
#define ff first
#define ss second
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL)
#define N 50000
vector<int> a[N];
map<int,int> x[N];
void solve(){
int n,m,o,p,q;
cin>>n>>m;
for(int i=o=0;i<n;i++){
cin>>p;
if(p>0) o=1;
while(p--){
cin>>q;
x[i][q]=1;
a[i].append(q);
}
}
for(int i=0;i<n;i++){
for(auto& j:a[i]){
for(auto& k:a[j]){
if(x[i][k]){
cout<<min(3,m);
return;
}
}
}
}
cout<<min(o+1,m);
}
int main(){
L0TA;
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
3928 KB |
Output is correct |
2 |
Correct |
2 ms |
4184 KB |
Output is correct |
3 |
Correct |
5 ms |
5700 KB |
Output is correct |
4 |
Runtime error |
1481 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
3928 KB |
Output is correct |
2 |
Correct |
2 ms |
4184 KB |
Output is correct |
3 |
Correct |
5 ms |
5700 KB |
Output is correct |
4 |
Runtime error |
1481 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
3932 KB |
Output is correct |
2 |
Correct |
1 ms |
3932 KB |
Output is correct |
3 |
Correct |
1 ms |
3928 KB |
Output is correct |
4 |
Correct |
1 ms |
3932 KB |
Output is correct |
5 |
Incorrect |
1 ms |
3932 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
3928 KB |
Output is correct |
2 |
Correct |
2 ms |
4184 KB |
Output is correct |
3 |
Correct |
5 ms |
5700 KB |
Output is correct |
4 |
Runtime error |
1481 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
3928 KB |
Output is correct |
2 |
Correct |
2 ms |
4184 KB |
Output is correct |
3 |
Correct |
5 ms |
5700 KB |
Output is correct |
4 |
Runtime error |
1481 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Halted |
0 ms |
0 KB |
- |