# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
363879 | ogibogi2004 | Norela (info1cup18_norela) | C++14 | 9 ms | 364 KiB |
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;
#define ll long long
ll n,m;
vector<ll>spells;
vector<ll>used;
vector<ll>ans;
ll xr=0;
void rec(int idx)
{
//cout<<idx<<" "<<xr<<endl;
if(used.size()>ans.size())return;
if(idx>spells.size())
{
if(xr==(1<<n)-1)
{
if(used.size()<ans.size())ans=used;
}
return;
}
else
{
rec(idx+1);
used.push_back(idx);
xr^=spells[idx];
rec(idx+1);
used.pop_back();
xr^=spells[idx];
}
}
int main()
{
cin>>n>>m;
for(int i=0;i<m;i++)
{
ll cnt;
cin>>cnt;
ll mask=0;
for(ll j=0;j<cnt;j++)
{
ll x;
cin>>x;mask|=(1<<(x-1));
}
spells.push_back(mask);
}
/*for(int i=0;i<m;i++)
{
cout<<spells[i]<<endl;
}*/
for(int i=0;i<m+2;i++)
{
ans.push_back(m+3);
}
rec(0);
cout<<ans.size()<<endl;
for(auto xd:ans)
{
cout<<xd+1<<" ";
}
cout<<endl;
return 0;
}
Compilation message (stderr)
# | 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... |