제출 #829335

#제출 시각아이디문제언어결과실행 시간메모리
829335Darren0724Political Development (BOI17_politicaldevelopment)C++17
0 / 100
9 ms2392 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(); 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 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...