#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
cerr<<vars<<" = ";
string delim="";
(...,(cerr<<delim<<values,delim=", "));
cerr<<"\n";
}
#else
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {}
#endif
#define pb push_back
#define sz(x) (int)(x.size())
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> inline void maxa(T& a,T b){a=max(a,b);}
template<typename T> inline void mina(T& a,T b){a=min(a,b);}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mxN=5e4+5; //make sure this is right
const int mod=1e9+7;
int n,k,deg[mxN],seen[mxN];
set<int> graph[mxN];
int main(){
cin.sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#ifdef LOCAL
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
cin>>n>>k;
priority_queue<pii,vector<pii>,greater<pii>> q;
for(int i=0;i<n;i++){
cin>>deg[i];
for(int j=0;j<deg[i];j++){
int x; cin>>x;
graph[i].insert(x);
}
q.push({deg[i],i});
}
int ans=1;
while(sz(q)){
pii cur=q.top(); q.pop();
if(cur.first!=deg[cur.second])
continue;
int at=cur.second;
seen[at]=1;
vector<int> nd={at};
for(int i:graph[at]){
if(!seen[i]){
deg[i]--;
q.push({deg[i],i});
nd.pb(i);
}
}
for(int mask=0;mask<(1<<sz(nd));mask++){
int yes=1;
for(int i=0;i<sz(nd);i++){
if(!(mask&(1<<i)))
continue;
for(int j=0;j<sz(nd);j++){
if(!(mask&(1<<j)))
continue;
if(i==j)
continue;
yes&=(graph[i].count(j));
yes&=(graph[j].count(i));
}
}
if(yes)
maxa(ans,__builtin_popcount(mask));
}
}
cout<<ans<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
2764 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2636 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
2636 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |