# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934892 | irmuun | Political Development (BOI17_politicaldevelopment) | C++17 | 161 ms | 310688 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
ll n,k,d[50000];
vector<ll>adj[50000];
vector<vector<bool>>dis(50000,vector<bool>(50000,0));
bool check(vector<ll>v){
for(ll i=0;i<v.size();i++){
for(ll j=i+1;j<v.size();j++){
if(dis[i][j]==false){
return false;
}
}
}
return true;
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin>>n>>k;
bool ok=false;
for(ll i=0;i<n;i++){
cin>>d[i];
if(d[i]>0) ok=true;
adj[i].resize(d[i]);
for(ll j=0;j<d[i];j++){
cin>>adj[i][j];
dis[i][adj[i][j]]=true;
}
}
bool k3=false;
ll ans=1;
for(ll i=0;i<n;i++){
if(d[i]<=10){
ll sz=d[i];
ll p=(1ll<<sz);
vector<ll>v;
for(ll j=0;j<p;j++){
for(ll r=0;r<sz;r++){
if(j&(1ll<<r)){
v.pb(adj[i][r]);
}
}
if(check(v)){
ans=max(ans,(ll)v.size()+1);
}
v.clear();
}
}
}
cout<<ans;
}
Compilation message (stderr)
# | 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... |