# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1003934 | vjudge1 | Pastiri (COI20_pastiri) | C++17 | 95 ms | 6208 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;
#define N 500010
#define M 50
#define INFLL 2000000000000000020
#define pb push_back
typedef long long ll;
typedef pair<ll,ll> pll;
vector<ll>resp;
ll vet[N];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n,k,u,v,i=0,ans,sz;
cin >> n >> k;
while(i<n-1)
{
cin >> u >> v;
i++;
}
i=0;
while(i<k)
{
cin >> vet[i];
i++;
}
sort(vet,vet+k);
vet[k]=vet[k-1];
for(i=0;i<k;i++)
{
if((vet[i+1]-vet[i])%2)
{
resp.pb(vet[i]);
}else
{
resp.pb((vet[i+1]+vet[i])/2);
i++;
}
}
sz=(ll)(resp.size());
cout << sz << endl;
for(i=0;i<sz;i++)
{
cout << resp[i] << ((i==sz-1) ? '\n' : ' ');
}
return 0;
}
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... |