# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
783021 | 2023-07-14T14:20:05 Z | 1075508020060209tc | Political Development (BOI17_politicaldevelopment) | C++14 | 7 ms | 3412 KB |
#include<bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second int n;int K; set<int>st[50100]; int tbl[5010][5010]; signed main(){ cin>>n>>K; for(int i=0;i<n;i++){ int d; cin>>d; for(int j=1;j<=d;j++){ int v; cin>>v; st[i].insert(v); // tbl[i][v]=1; } // tbl[i][i]=1; st[i].insert(i); } int ans=1; for(int i=0;i<1;i++){ vector<int>vc; for(auto it=st[i].begin();it!=st[i].end();it++){ vc.push_back(*it); } for(int A=0;A<(1<<vc.size());A++){ int ok=1; // cout<<A<<"A\n"; for(int j=0;j<vc.size();j++){ // cout<<vc[j]<<" "<<ok<<endl;; if(!ok){continue;} if(((A&(1<<j))!=0)){ for(int k=0;k<vc.size();k++){ if( ((A&(1<<k))==0) ){continue;} //cout<<A<<" "<<k<<endl; if(st[vc[j]].find(vc[k])==st[vc[j]].end()){ok=0;} // cout<<A<<" "<<vc[j]<<" "<<vc[k]; //if(tbl[vc[j]][vc[k]]==0){ok=0;} //cout<<" "<<ok<<endl; } } } //cout<<ok<<endl; if((ok&&(__builtin_popcount(A)>ans)) ){ ans=__builtin_popcount(A); } } } cout<<ans<<endl; //return 0; /* for(int i=0;i<ans.size();i++){ cout<<ans[i]<<" "; }*/ }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2660 KB | Output is correct |
2 | Correct | 2 ms | 2664 KB | Output is correct |
3 | Correct | 7 ms | 3312 KB | Output is correct |
4 | Correct | 5 ms | 3312 KB | Output is correct |
5 | Correct | 5 ms | 3412 KB | Output is correct |
6 | Correct | 5 ms | 3412 KB | Output is correct |
7 | Correct | 5 ms | 3412 KB | Output is correct |
8 | Correct | 2 ms | 2796 KB | Output is correct |
9 | Correct | 1 ms | 2644 KB | Output is correct |
10 | Incorrect | 2 ms | 2900 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2660 KB | Output is correct |
2 | Correct | 2 ms | 2664 KB | Output is correct |
3 | Correct | 7 ms | 3312 KB | Output is correct |
4 | Correct | 5 ms | 3312 KB | Output is correct |
5 | Correct | 5 ms | 3412 KB | Output is correct |
6 | Correct | 5 ms | 3412 KB | Output is correct |
7 | Correct | 5 ms | 3412 KB | Output is correct |
8 | Correct | 2 ms | 2796 KB | Output is correct |
9 | Correct | 1 ms | 2644 KB | Output is correct |
10 | Incorrect | 2 ms | 2900 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2900 KB | Output is correct |
2 | Incorrect | 2 ms | 2660 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2660 KB | Output is correct |
2 | Correct | 2 ms | 2664 KB | Output is correct |
3 | Correct | 7 ms | 3312 KB | Output is correct |
4 | Correct | 5 ms | 3312 KB | Output is correct |
5 | Correct | 5 ms | 3412 KB | Output is correct |
6 | Correct | 5 ms | 3412 KB | Output is correct |
7 | Correct | 5 ms | 3412 KB | Output is correct |
8 | Correct | 2 ms | 2796 KB | Output is correct |
9 | Correct | 1 ms | 2644 KB | Output is correct |
10 | Incorrect | 2 ms | 2900 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2660 KB | Output is correct |
2 | Correct | 2 ms | 2664 KB | Output is correct |
3 | Correct | 7 ms | 3312 KB | Output is correct |
4 | Correct | 5 ms | 3312 KB | Output is correct |
5 | Correct | 5 ms | 3412 KB | Output is correct |
6 | Correct | 5 ms | 3412 KB | Output is correct |
7 | Correct | 5 ms | 3412 KB | Output is correct |
8 | Correct | 2 ms | 2796 KB | Output is correct |
9 | Correct | 1 ms | 2644 KB | Output is correct |
10 | Incorrect | 2 ms | 2900 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |