Submission #1115857

#TimeUsernameProblemLanguageResultExecution timeMemory
1115857BuzzyBeezPolitical Development (BOI17_politicaldevelopment)C++17
54 / 100
3082 ms322448 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, all; 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}), 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; 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 = 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[_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...