#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
const ll mod = 998244353;
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define faster ios::sync_with_stdio(false);cin.tie(nullptr)
int main() {
ll N,K;
cin >> N >> K;
vector<set<ll>> s(N);
set<pair<ll,ll>> S;
rep(i,N){
ll D;
cin >> D;
rep(j,D){
ll x;
cin >> x;
s[i].insert(x);
}
s[i].insert(i);
S.insert({D+1,i});
}
ll ans=0;
while(S.size()!=0){
auto it=*S.begin();
S.erase(it);
ll sz=it.fi;
ll i=it.se;
vector<ll> A(sz);
auto itr=s[i].begin();
ll cnt=0;
while(itr!=s[i].end()){
A[cnt]=*itr;
itr++;
cnt++;
}
rep(bit,1<<sz){
bool ok=true;
ll l=sz;
rep(j,sz){
if(bit&(1<<j)) l--;
rep(k,sz){
if(bit&(1<<j)) continue;
if(bit&(1<<k)) continue;
if(s[j].find(k)==s[j].end()) ok=false;
}
}
if(ok) ans=max(ans,l);
}
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
29 ms |
1624 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
29 ms |
1624 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1116 KB |
Output is correct |
2 |
Incorrect |
0 ms |
436 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
29 ms |
1624 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
29 ms |
1624 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |