//Dedicated to my love,ivaziva
#include <bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define sz(a) ((int) (a).size())
#define pb emplace_back
#define me(a, x) memset(a, x, sizeof(a))
#define vi vector<int>
#define i128 __int128
using namespace std;
const int N = 5e4 + 7;
int n, k;
vi g[N];
int main() {
ios :: sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> k;
L(i, 0, n - 1) {
int d; cin >> d;
L(j, 1, d) {
int v; cin >> v;
g[i].pb(v);
}
}
int ans = 0;
L(i, 0, n - 1) {
int si = sz(g[i]);
set<int> a;
L(msk, 1, (1 << si) - 1) {
a.insert(i);
L(j, 0, si) {
if(msk & (1 << j)) a.insert(g[i][j]);
}
bool ok = true;
for(auto x : a) {
if(x == i) continue;
int cnt = 1;
for(auto u : g[x]) {
cnt += a.count(u);
}
if(cnt != sz(a)) ok = false;
}
a.clear();
if(ok) ans = max(ans, __builtin_popcount(msk));
}
}
cout << ans + 1 << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |