제출 #1128407

#제출 시각아이디문제언어결과실행 시간메모리
1128407stdfloatPolitical Development (BOI17_politicaldevelopment)C++20
16 / 100
3106 ms314912 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int mx; vector<int> v; vector<bool> vis; vector<vector<bool>> edg; vector<vector<int>> E; void dfs(int x) { mx = max(mx, (int)v.size()); for (auto i : E[x]) { if (vis[i]) continue; bool ok = true; for (auto j : v) { if (!edg[i][j] || !edg[j][i]) { ok = false; break; } } if (!ok) continue; vis[i] = true; v.push_back(i); dfs(i); vis[i] = false; v.pop_back(); } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, k; cin >> n >> k; edg.assign(n, vector<bool>(n)); for (int i = 0; i < n; i++) { int d; cin >> d; while (d--) { int y; cin >> y; edg[i][y] = true; } } E.assign(n, {}); for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (edg[i][j] && edg[j][i]) { E[i].push_back(j); E[j].push_back(i); } } } for (int i = 0; i < n; i++) { v = {i}; vis.assign(n, false); vis[i] = true; dfs(i); } cout << mx; }
#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...