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 OYY LLONG_MAX
#define mod 998244353
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 500005
#define fi first
#define se second
vector<int> v[lim];
int32_t main(){
faster
int n,k;cin>>n>>k;
FOR{
if(i==1)continue;
int a,b;cin>>a>>b;
v[a].push_back(b);
v[b].push_back(a);
}
int dizi[k+1];
for(int i=1;i<=k;i++){
cin>>dizi[i];
}
sort(dizi+1,dizi+1+k);
set<int> cev;
for(int i=1;i<=k;i++){
if(i!=k && (dizi[i+1]-dizi[i])%2==0){
cev.insert((dizi[i+1]+dizi[i])/2);
}
else cev.insert(dizi[i]);
}
cout<<cev.size()<<'\n';
for(auto x:cev){
cout<<x<<" ";
}
cout<<'\n';
return 0;
}
# | 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... |