이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#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... |