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")
#include <bits/stdc++.h>
using namespace std;
#define ve vector
typedef long long ll;
int n, k, r;
ve<set<int>> G;
ve<int> S;
void f(int i, int s) {
bool valid;
if (i < k) {
for (int j = s; j < n; j++) {
valid = true;
for (int l : S) {
if (G[l].find(j) == G[l].end() || G[j].find(l) == G[j].end()) {
valid = false;
break;
}
}
if (valid) {
S.push_back(i);
r = max(r, i + 1);
f(i + 1, j + 1);
S.pop_back();
}
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int d, a;
cin >> n >> k;
G = ve<set<int>>(n);
for (int i = 0; i < n; i++) {
cin >> d;
for (int j = 0; j < d; j++) {
cin >> a;
G[i].insert(a);
}
}
r = 0;
f(0, 0);
cout << r << endl;
return 0;
}
# | 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... |