Submission #775668

# Submission time Handle Problem Language Result Execution time Memory
775668 2023-07-06T18:06:41 Z DangerNoodle7591 Pastiri (COI20_pastiri) C++17
8 / 100
113 ms 13824 KB
#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 time Memory Grader output
1 Correct 60 ms 6860 KB Output is correct
2 Correct 59 ms 6936 KB Output is correct
3 Correct 69 ms 6940 KB Output is correct
4 Correct 113 ms 13824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Sheep 3030 not protected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Sheep 128 not protected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 7116 KB Sheep 54 not protected
2 Halted 0 ms 0 KB -