Back
Close

Sum of vectors

Statement

 Goal

You're given an array of vectors in a D-dimensional space. Negate every second vector on the list, then sum them all up and print the resulting vector.
Input
Line 1: The dimension D and the amount N of vectors.
Next N lines: D integers representing a vector.
Output
The resulting vector.
Constraints
0 < D < 8
0 < N < 16
Example
Input
3 2
2 3 4
1 1 1
Output
1 2 3

Game modes
Fastest, Shortest, Reverse

Test cases
Simple Test
Input
3 2 2 3 4 1 1 1
Output
1 2 3

Simple Validator
Input
3 2 2 3 4 1 1 1
Output
1 2 3

Almost simple Test
Input
4 3 2 3 4 5 1 1 1 1 2 2 2 2
Output
3 4 5 6

Almost simple Validator
Input
4 3 2 3 4 -5 1 1 1 -1 2 2 2 -2
Output
3 4 5 -6

Normal Test
Input
4 4 2 3 4 5 1 1 1 1 2 2 2 2 1 2 3 4
Output
2 2 2 2

Normal Validator
Input
4 4 2 3 4 -5 1 1 1 -1 2 2 2 -2 1 2 3 -4
Output
2 2 2 -2

Less normal Test
Input
4 5 2 3 4 5 1 1 1 1 2 2 2 2 1 2 3 4 5 3 6 1
Output
7 5 8 3

Less normal Validator
Input
4 5 2 3 4 -5 1 1 1 -1 2 2 2 -2 1 2 3 -4 5 3 6 -1
Output
7 5 8 -3

Insane! Test
Input
7 15 28 -5 -9 -4 8 -8 13 20 0 10 -4 14 4 8 18 30 15 23 6 24 -8 -9 29 12 4 8 28 26 -5 1 25 6 20 -1 -5 9 -7 2 5 18 25 22 1 22 18 29 -5 9 15 29 14 30 22 -4 3 2 -5 30 8 18 22 25 27 -9 3 0 20 9 -2 11 13 13 5 25 5 19 30 1 12 2 20 20 5 7 -5 21 3 22 11 5 15 11 25 27 26 -8 22 15 -3 -8 -9 -6 -9 -6 7
Output
-10 28 -27 20 1 -18 3

A suspicious validator Validator
Input
7 15 8 11 -6 13 14 4 29 23 17 -6 23 -4 -8 -7 -3 18 3 9 -6 -7 10 -9 26 9 17 20 0 -3 -3 8 15 -7 13 18 2 -2 16 28 22 9 29 16 -7 4 6 5 -3 23 -6 -5 -5 11 0 10 28 10 -1 7 0 13 28 10 4 7 -8 -8 -4 20 27 -5 1 17 19 4 -2 30 -5 13 -9 20 -5 16 20 4 -2 -8 29 18 18 16 2 27 22 24 6 11 26 8 13 16 27 6 23 17 6
Output
-48 14 15 2 3 -11 19

Solution language

Solution

Stub generator input