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 <vector>
#include <algorithm>
#define int int64_t
using namespace std;
struct tree
{
vector<int> adjlist;
};
signed main()
{
int n, m, k;
cin >> n >> m >> k;
if (m == k)
{
vector<int> nr(n);
vector<pair<int,int>> edg;
for (int i = 0; i < n - 1; i++)
{
int a, b;
a--; b--;
cin >> a >> b;
edg.emplace_back(a, b);
}
for (int i = 0; i < m; i++)
{
int cnt;
cin >> cnt;
for (int l = 0; l < cnt; l++)
{
int a;
a--;
cin >> a;
nr[a]++;
}
}
vector<int> sol;
for (int i = 0; i < n - 1; i++)
{
if (min(nr[edg[i].first], nr[edg[i].second]) == k) sol.push_back(i + 1);
}
cout << sol.size() << "\n";
for (auto i : sol) cout << i << " ";
cout << "\n";
}
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |