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;
const int N=50005;
vector<int> adj[N];
vector<int> deg(N);
set<pair<int,int>> s;
int calc(int p){
int sz=adj[p].size();
int g[sz]{};
for(int i=0;i<sz;i++){
for(int j=0;j<sz;j++){
if(i==j||s.find({i,j})!=s.end()){
g[i]|=1<<j;
}
}
}
int ans=0;
for(int i=1;i<1<<sz;i++){
int p=i;
int cnt=0;
for(int j=0;j<sz;j++){
if(i&(1<<j)){
p&=g[j];
cnt++;
}
}
if(p==i){
ans=max(ans,cnt);
}
}
return ans;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,k;cin>>n>>k;
for(int i=0;i<n;i++){
cin>>deg[i];
adj[i].resize(deg[i]+1);
adj[i][0]=i;
for(int j=1;j<=deg[i];j++){
cin>>adj[i][j];
s.insert({i,adj[i][j]});
s.insert({adj[i][j],i});
}
}
int ans=0;
for(int i=0;i<n;i++){
//cout<<calc(i)<<endl;
ans=max(ans,calc(i));
}
cout<<ans<<endl;
return 0;
}
# | 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... |