#K9156. Balanced Array Generation
Balanced Array Generation
Balanced Array Generation
Given two integers (n) and (m), construct a balanced array of length (n), where each element is an integer between 1 and (m) (inclusive) and the sum of the first half of the array is equal to the sum of the second half. It is guaranteed that (n) is even.
For example, if (n = 4) and (m = 5), one valid balanced array is 1 1 1 1
(since (1+1 = 1+1)). Note that any balanced array satisfying the conditions is acceptable.
inputFormat
The input consists of two space-separated integers: (n) (an even number) and (m), where (1 \le n \le 10^5) and (1 \le m \le 10^9).
outputFormat
Output a balanced array of (n) integers separated by a single space such that the sum of the first (\frac{n}{2}) numbers is equal to the sum of the last (\frac{n}{2}) numbers.## sample
4 5
1 1 1 1
</p>