Submission #775668

#TimeUsernameProblemLanguageResultExecution timeMemory
775668DangerNoodle7591Pastiri (COI20_pastiri)C++17
8 / 100
113 ms13824 KiB
#include<bits/stdc++.h> using namespace std; #define lalala ios_base::sync_with_stdio(false);cin.tie(NULL); #define endl "\n" //#define int long long int #define N 500005 int main(){ lalala; int n,k;cin>>n>>k; for(int i=0;i<n-1;i++){int a,b;cin>>a>>b;} int koyun[k],kacak[k]; for(int i=0;i<k;i++){ cin>>koyun[i]; kacak[i]=0; } sort(koyun,koyun+k); vector<int> simyaci; for(int i=0;i<k-1;i++){ if((koyun[i+1]-koyun[i])%2==0){ simyaci.push_back((koyun[i]+koyun[i+1])/2); kacak[i]=kacak[i+1]=1; i++; } } for(int i=0;i<k;i++){ if(kacak[i])continue; simyaci.push_back(koyun[i]); } cout<<simyaci.size()<<endl; for(auto u:simyaci)cout<<u<<" "; cout<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...