# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
239306 | dsjong | Railway (BOI17_railway) | C++17 | 52 ms | 3440 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 <bits/stdc++.h>
using namespace std;
int cnt[100005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, m, k;
cin>>n>>m>>k;
assert(m==k);
vector<pair<int, int>>edges;
for(int i=1;i<n;i++){
int x, y;
cin>>x>>y;
edges.push_back({x, y});
}
memset(cnt, 0, sizeof cnt);
for(int i=1;i<=m;i++){
int s;
cin>>s;
for(int j=1;j<=s;j++){
int x;
cin>>x;
cnt[x]++;
}
}
vector<int>ans;
for(int i=0;i<edges.size();i++){
int x=edges[i].first, y=edges[i].second;
if(cnt[x]==m && cnt[y]==m){
ans.push_back(i+1);
}
}
cout<<ans.size()<<"\n";
for(int i:ans){
cout<<i<<" ";
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |