# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1115839 | vjudge1 | Political Development (BOI17_politicaldevelopment) | C++17 | 776 ms | 310268 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <bitset>
#include <vector>
using namespace std;
bitset<50005> b[50005], bb;
vector<vector<int>> v[11];
vector<int> va;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, k, res = 1;
cin >> n >> k;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
for (int j = 0; j < x; j++) {
int y;
cin >> y;
if (y > i) {
b[i][y] = 1;
v[2].push_back({i, y});
}
}
}
for (int i = 2; i <= k; i++) {
if (v[i].empty()) break;
res = i;
if (i == k) break;
for (auto w : v[i]) {
bb = b[w[0]];
for (int i = 1; i < w.size(); i++) {
bb &= b[w[i]];
}
for (int j = bb._Find_first(); j <= n; j = bb._Find_next(j)) {
va = w;
va.push_back(j);
v[i + 1].push_back(va);
}
}
}
cout << res;
}
Compilation message (stderr)
# | 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... |