Submission #363881

# Submission time Handle Problem Language Result Execution time Memory
363881 2021-02-07T12:41:30 Z ogibogi2004 Norela (info1cup18_norela) C++14
100 / 100
344 ms 492 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==(1ll<<n)-1ll)
		{
			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|=(1ll<<(x-1ll));
		}
		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 Correct 3 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 47 ms 372 KB Output is correct
9 Correct 30 ms 364 KB Output is correct
10 Correct 13 ms 364 KB Output is correct
11 Correct 26 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 47 ms 372 KB Output is correct
9 Correct 30 ms 364 KB Output is correct
10 Correct 13 ms 364 KB Output is correct
11 Correct 26 ms 384 KB Output is correct
12 Correct 38 ms 364 KB Output is correct
13 Correct 96 ms 364 KB Output is correct
14 Correct 36 ms 364 KB Output is correct
15 Correct 11 ms 364 KB Output is correct
16 Correct 61 ms 364 KB Output is correct
17 Correct 35 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 3 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 47 ms 372 KB Output is correct
9 Correct 30 ms 364 KB Output is correct
10 Correct 13 ms 364 KB Output is correct
11 Correct 26 ms 384 KB Output is correct
12 Correct 38 ms 364 KB Output is correct
13 Correct 96 ms 364 KB Output is correct
14 Correct 36 ms 364 KB Output is correct
15 Correct 11 ms 364 KB Output is correct
16 Correct 61 ms 364 KB Output is correct
17 Correct 35 ms 364 KB Output is correct
18 Correct 30 ms 364 KB Output is correct
19 Correct 28 ms 492 KB Output is correct
20 Correct 344 ms 364 KB Output is correct
21 Correct 221 ms 364 KB Output is correct
22 Correct 127 ms 364 KB Output is correct
23 Correct 14 ms 364 KB Output is correct