Submission #1115853

#TimeUsernameProblemLanguageResultExecution timeMemory
1115853BuzzyBeezPolitical Development (BOI17_politicaldevelopment)C++17
54 / 100
3087 ms322248 KiB
#include <bits/stdc++.h> using namespace std; bitset<50001> G[50001], cur, all; vector<vector<int>> C[11]; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, sz, u, v; cin >> n >> k; for (int i = 0; i < n; ++i) C[1].push_back({i}), G[i][i] = 1, all[i] = 1; for (u = 0; u < n; ++u) { cin >> sz; while (sz--) cin >> v, G[u][v] = 1; } vector<int> tmp; for (sz = 2; sz <= k; ++sz) { for (auto small_clique : C[sz - 1]) { cur = all; for (int i : small_clique) cur &= G[i]; for (int j = small_clique.back() + 1; j < n; ++j) if (cur[j]) { tmp = small_clique; tmp.push_back(j); C[sz].push_back(tmp); } } if (C[sz].empty()) {cout << sz - 1; return 0;} // cout << sz << "!!" << '\n'; // for (auto clique : C[sz]) { // for (int i : clique) cout << i << ' '; // cout << '\n'; // } } cout << k; }
#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...