This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |