1 条题解
-
0林思源 (linsiyuan) LV 8 @ 2024-9-21 20:36:29
#include <bits/stdc++.h> using namespace std; #define int long long const int N=1e5+10; int a[114514]; int con(int x) { int cntt = 0; for (;x;x>>=1) { if(x&1) cntt++; } return cntt; } signed main() { int n,d,k; cin >> n >> d >> k; for (int i = 1; i <= n; i++) { int x; cin >> x; while(x--) { int w; cin >> w; a[i] |= 1 << (w-1); } } int w = 1<<d,ans = -1; for (int i = 0; i <= w; i++) { int cnt = 0; if (con(i) > k) continue; for (int j = 1; j <= n; j++) { if ((i&a[j])== a[j])cnt++; } ans = max(ans,cnt); } cout << ans; }
- 1
信息
- ID
- 2533
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 10
- 标签
- 递交数
- 1
- 已通过
- 1
- 上传者