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;
typedef long long ll;
typedef long double ld;
int n,m;
ll mask[30];
int st[30],vf=0;
void go(int p,ll cur)
{
if(p>m)
{
if(cur==0)
{
for(int i=1;i<=vf;i++)
{
cout<<st[i]<<" ";
}
cout<<"\n";
exit(0);
}
}
else
{
st[++vf]=p;
go(p+1,(cur^mask[p]));
vf--;
go(p+1,cur);
}
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>m;
for(int i=1;i<=m;i++)
{
int l;
cin>>l;
for(int j=1;j<=l;j++)
{
int bit;
cin>>bit;
bit--;
mask[i]+=(1LL<<bit);
}
}
go(1,(1LL<<n)-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... |