1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<iostream>
#include<vector>

#define VECINT std::vector<int>
#define LL long long int

int main(){
	std::ios_base::sync_with_stdio(false);
	
	unsigned int n,k;
	std::cin>>n>>k;
	
	VECINT A(n),B(n),C(n);
	int a,b,z;
	LL rA=0,rB=0;
	for(unsigned int i=0;i<n;++i) std::cin>>A[i];
	for(unsigned int i=0;i<n;++i) std::cin>>B[i];
	for(unsigned int i=0;i<n;++i){
		a=A[i],b=B[i],z=abs(a-b);
		if(rA<rB){
			if(a<b) C[i]=a+z-(z/2);
			else C[i]=a-z+(z/2);
		}
		else{ 
			if(a<b) C[i]=b-z+(z/2);
			else  C[i]=b+z-(z/2);
		}
		rA+=abs(C[i]-a),rB+=abs(C[i]-b);
	}

	for(unsigned int i=0;i<n;++i)
		std::cout<<C[i]<<" ";
		
	std::cout<<"\n";
	
	return 0;
}