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
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <algorithm>
#define f first
#define s second
using namespace std;

const int size = 100004;

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	int A[n], B[n];
	bool change = false;
	for(int i = 0; i<n; i++)	scanf("%d", &A[i]);
	for(int i = 0; i<n; i++)	scanf("%d", &B[i]);
	for(int i = 0; i<n; i++) {
		int x = abs(A[i]-B[i]);
		if(x%2) {
			printf("%d ", min(A[i], B[i]) + x/2);
		} else {
			if(change == false) {
				printf("%d ", min(A[i], B[i]) + x/2);
				change = true;
			}
			else {
				printf("%d ", max(A[i], B[i]) - x/2);
				change = false;
			}
		}
	}
	printf("\n");
	return 0;
}