Submission #829329

#TimeUsernameProblemLanguageResultExecution timeMemory
829329Darren0724Political Development (BOI17_politicaldevelopment)C++17
0 / 100
1 ms1632 KiB
#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(); if(sz==0)return 1; 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]); for(int j=0;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++){ ans=max(ans,calc(i)); } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...