제출 #1128990

#제출 시각아이디문제언어결과실행 시간메모리
1128990MuhammetPolitical Development (BOI17_politicaldevelopment)C++20
16 / 100
296 ms312604 KiB
#include "bits/stdc++.h" using namespace std; #define SZ(s) (int)s.size() int n, k, ans; vector <bool> vis; vector <vector <bool>> a; vector <int> v1; vector <vector <int>> v; void dfs(int x){ ans = max(ans, SZ(v1)); for(auto i : v[x]){ if(vis[i]) continue; bool tr = 0; for(auto j : v1){ if(!a[i][j] or !a[j][i]){ tr = 1; break; } } if(!tr){ v1.push_back(i); vis[i] = true; dfs(i); v1.pop_back(); } } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> k; v.resize(n+1), vis.assign(n+1,0); a.assign(n+1, vector<bool> (n+1,0)); bool tr = 0; for(int i = 0; i < n; i++){ int d; cin >> d; if(d != 0) tr = 1; while(d--){ int x; cin >> x; a[i][x] = true; v[i].push_back(x); } } for(int i = 0; i < n; i++){ v1.push_back(i); vis[i] = true; dfs(i); v1.pop_back(); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...