#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
signed main(){
fastio
int n,m;
cin >> n >> m;
vector<int> v(m);
for(int i = 0;i < m;i++){
int q;
cin >> q;
int tmp = 0;
for(int j = 0;j < q;j++){
int x;
cin >> x;
x--;
tmp ^= (1LL<<x);
}
v[i] = tmp;
}
reverse(v.begin(),v.end());
int ans = (1LL<<61)-1;
for(int i = 0;i < (1<<m);i++){
int now = (1LL<<n)-1;
for(int j = 0;j < m;j++){
if(i&(1LL<<j)){
now ^= v[j];
}
}
if(now==0){
if(__builtin_popcountll(ans) >= __builtin_popcountll(i)) ans = i;
}
}
cout << __builtin_popcountll(ans) << "\n";
for(int j = m-1;~j;j--){
if(ans&(1LL<<j)){
cout << m-j << " ";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
304 KB |
Output is correct |
2 |
Correct |
16 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
15 ms |
204 KB |
Output is correct |
5 |
Correct |
17 ms |
304 KB |
Output is correct |
6 |
Correct |
23 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
304 KB |
Output is correct |
2 |
Correct |
16 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
15 ms |
204 KB |
Output is correct |
5 |
Correct |
17 ms |
304 KB |
Output is correct |
6 |
Correct |
23 ms |
344 KB |
Output is correct |
7 |
Correct |
63 ms |
204 KB |
Output is correct |
8 |
Correct |
139 ms |
284 KB |
Output is correct |
9 |
Correct |
131 ms |
204 KB |
Output is correct |
10 |
Correct |
127 ms |
324 KB |
Output is correct |
11 |
Correct |
130 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
304 KB |
Output is correct |
2 |
Correct |
16 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
15 ms |
204 KB |
Output is correct |
5 |
Correct |
17 ms |
304 KB |
Output is correct |
6 |
Correct |
23 ms |
344 KB |
Output is correct |
7 |
Correct |
63 ms |
204 KB |
Output is correct |
8 |
Correct |
139 ms |
284 KB |
Output is correct |
9 |
Correct |
131 ms |
204 KB |
Output is correct |
10 |
Correct |
127 ms |
324 KB |
Output is correct |
11 |
Correct |
130 ms |
204 KB |
Output is correct |
12 |
Correct |
137 ms |
284 KB |
Output is correct |
13 |
Correct |
268 ms |
284 KB |
Output is correct |
14 |
Correct |
261 ms |
292 KB |
Output is correct |
15 |
Correct |
269 ms |
296 KB |
Output is correct |
16 |
Correct |
270 ms |
204 KB |
Output is correct |
17 |
Correct |
272 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
304 KB |
Output is correct |
2 |
Correct |
16 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
15 ms |
204 KB |
Output is correct |
5 |
Correct |
17 ms |
304 KB |
Output is correct |
6 |
Correct |
23 ms |
344 KB |
Output is correct |
7 |
Correct |
63 ms |
204 KB |
Output is correct |
8 |
Correct |
139 ms |
284 KB |
Output is correct |
9 |
Correct |
131 ms |
204 KB |
Output is correct |
10 |
Correct |
127 ms |
324 KB |
Output is correct |
11 |
Correct |
130 ms |
204 KB |
Output is correct |
12 |
Correct |
137 ms |
284 KB |
Output is correct |
13 |
Correct |
268 ms |
284 KB |
Output is correct |
14 |
Correct |
261 ms |
292 KB |
Output is correct |
15 |
Correct |
269 ms |
296 KB |
Output is correct |
16 |
Correct |
270 ms |
204 KB |
Output is correct |
17 |
Correct |
272 ms |
204 KB |
Output is correct |
18 |
Correct |
559 ms |
296 KB |
Output is correct |
19 |
Correct |
548 ms |
204 KB |
Output is correct |
20 |
Execution timed out |
1084 ms |
204 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |