// CAU DUA DU DAU
#include <bits/stdc++.h>
using namespace std;
#define uf(i, a, b) for (int i = (a); i <= (b); i++)
#define df(i, a, b) for (int i = (a); i >= (b); i--)
#define rep(i, n) for (int i = 1; i <= (n); i++)
#define ll long long
#define sz(k) (int)k.size()
#define task "TOYS"
template <class T>
bool maximize(T &a, const T &b){
if (a < b){
a = b;
return 1;
} else return 0;
};
template <class T>
bool minimize(T &a, const T &b){
if (a > b){
a = b;
return 1;
} else return 0;
};
const int maxn = 1e6+10;
const ll MOD = 1e9+7;
int n, m, toy[maxn], bitmax[maxn], cnt[1 << 20], dp[1 << 20];
void sub1(){
cnt[0] = 1;
for (int i = 1; i <= n; i++){
for (int mask = (1 << m) - 1; mask >= 0; mask--){
if (cnt[mask]){
cnt[mask | toy[i]] += cnt[mask];
}
}
}
cout << cnt[(1 << m) - 1];
}
void solve(){
cin >> n >> m;
rep(i, n){
int k, x;
cin >> k;
rep(j, k) cin >> x, toy[i] += (1 << (x-1));
for (int b = m; b >= 0; b--) if ((toy[i] >> b) & 1){
bitmax[i] = b;
break;
}
}
if (n <= 100 && m <= 15) sub1();
else cout << (1 << m)-1;
// else if (1) sub2();
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int numTest = 1;
// cin >> numTest;
while (numTest--) solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
3 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
16 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
17 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
18 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
19 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
20 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |