This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |