제출 #223748

#제출 시각아이디문제언어결과실행 시간메모리
223748johuthaRailway (BOI17_railway)C++17
0 / 100
137 ms4584 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...