제출 #1134125

#제출 시각아이디문제언어결과실행 시간메모리
1134125bpptidpNorela (info1cup18_norela)C++20
0 / 100
15 ms328 KiB
#include<bits/stdc++.h> using namespace std; using ll=long long; ll c[26]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n,m; cin>>n>>m; for(int i=0,q,x;i<m;++i){ cin>>q; while(q--){ cin>>x; c[i]|=(1ll<<(x-1)); } } ll g=0; for(int i=0;i<n;++i)g|=(1ll<<i); int ans=0,nw; for(int j=0;j<m;++j) ans|=(1<<j); for(int msk=1;msk<(1<<m);++msk){ ll x=g; nw=0; for(int j=0;j<m;++j){ if(msk&(1<<j)){ x^=c[j]; nw|=(1<<j); } } if(!x){ int pc1=__builtin_popcount(ans); int pc2=__builtin_popcount(nw); if(pc1<pc2)continue; if(pc1>pc2)ans=nw; else ans=min(ans,nw); } } cout<<__builtin_popcount(ans)<<'\n'; for(int i=0;i<m;++i) if(ans&(1<<i))cout<<i+1<<' '; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...