Submission #1115866

#TimeUsernameProblemLanguageResultExecution timeMemory
1115866vjudge1Political Development (BOI17_politicaldevelopment)C++17
100 / 100
327 ms321268 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,avx2,popcnt,lzcnt") #include <bits/stdc++.h> using namespace std; bitset<50001> G[50001], cur; vector<vector<int>> C[2]; 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}); for (u = 0; u < n; ++u) { cin >> sz; while (sz--) cin >> v, G[min(u, v)][max(u, v)] = 1; } vector<int> tmp; int _c, _p; for (sz = 2; sz <= k; ++sz) { _c = sz & 1; _p = 1 ^ _c; C[_c].clear(); for (auto small_clique : C[_p]) { cur = G[small_clique[0]]; for (int i = 1; i + 1 < sz; ++i) cur &= G[small_clique[i]]; for (int j = cur._Find_first(); j < n; j = cur._Find_next(j)) if (cur[j]) { tmp = small_clique; tmp.push_back(j); C[_c].push_back(tmp); } } if (C[_c].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...