This is my solution to the recent AtCoder ABC356 Problem C
#include <bits/stdc++.h>
using namespace std;
int M = 1e9 + 7;
void sort(vector<int> &a) {
sort(a.begin(), a.end());
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
map<set<int>, bool> a;
int n, m, K;
int ans = 0;
cin >> n >> m >> K;
for (int i = 0; i < m; i++) {
int c;
cin >> c;
set<int> s;
for (int j = 0; j < c; j++) {
int x;
cin >> x;
s.insert(x);
}
char ch;
cin >> ch;
a[s] = ch == 'o';
}
for (int b = 1; b < (1 << n); b++) {
set<int> st;
for (int i = 0; i < n; i++) {
if (b & (1<<i)) st.insert(i + 1);
}
//if (st.size() < K) continue;
bool can = true;
for (const auto& i : a) {
int ct = 0;
for (auto e : st) {
if (i.first.count(e)) ++ct;
}
if (i.second) {
if (ct < K) can = false;
} else {
if (ct >= K) can = false;
}
}
ans += can;
}
cout << ans << "\n";
}
My solution is similar in logic and code to the one suggested in official editorial, but got WA on 4 test. Please help.