Submission #363879

# Submission time Handle Problem Language Result Execution time Memory
363879 2021-02-07T12:40:41 Z ogibogi2004 Norela (info1cup18_norela) C++14
0 / 100
9 ms 364 KB
#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

norela.cpp: In function 'void rec(int)':
norela.cpp:13:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  if(idx>spells.size())
      |     ~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 9 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 9 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 9 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 9 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -