#include<bits/stdc++.h>
using namespace std;
int n,m;
vector<int>ans;
vector<int>sp[27],koji[66];
bitset<66>bsp[26];
bool losi[(1<<25)],imao[(1<<25)];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>n>>m;
for(int i=0,q,x;i<m;++i){
cin>>q;
while(q--){
cin>>x;
sp[i].push_back(x);
koji[x].push_back(i);
bsp[i][x]=1;
}
}
for(int x=1;x<=n;++x){
int msk=0;
for(int i:koji[x])
msk^=(1<<i);
if(imao[msk])continue;
imao[msk]=1;
for(int s=msk;s;s=(s-1)&msk)
if(__builtin_popcount(s)&1^1)losi[s]=1;
}
for(int msk=1;msk<=(1<<m);++msk){
//if(losi[msk])continue;
bitset<66>b;
for(int i=0;i<m;++i)
if(msk&(1<<i))b^=bsp[i];
if(b.count()!=n)continue;
cout<<__builtin_popcount(msk)<<'\n';
for(int i=0;i<m;++i)
if(msk&(1<<i))cout<<i+1<<' ';
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... |