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;
#define int long long
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
int n, m, k;
vector< pair<int, int> > edge;
main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> n >> m >> k;
for(int i = 1;i < n; i++){
int a, b; cin >> a >> b;
edge.push_back({a, b});
}
map<int, int> mp;
for(int i = 0;i < m; i++){
int sz; cin >> sz;
if(sz % 2) assert(false);
for(int j = 0;j < sz; j++){
int idx; cin >> idx;
mp[idx]++;
}
}
vector<int> ans;
for(auto [x, y] : mp){
if(y >= k){
ans.push_back(x);
}
}
sort(all(ans));
cout << ans.size() << '\n';
for(int x : ans) cout << x << ' ';
return 0;
}
Compilation message (stderr)
railway.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
13 | main(){
| ^~~~
# | 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... |