Everyone Knows
Time: 1 s
Memory: 125 MB
Memory: 125 MB
You are given an integer \(N\). Construct an array of \(N\) distinct odd integers such that:
- The sum of all elements is exactly \(N \cdot (N+1)\)
- Each element \(A_i\) must satisfies the range constraint: \((1 \leq A_i \leq 5 \cdot 10^{6})\)
Input
The only line contains a single integer \(N\) Output
If it's impossible to construct an array, then print \(-1\).Otherwise, Print \(N\) space-separated distinct odd integers that satisfy the given conditions..
If there are multiple valid arrays, any one of them will be accepted.
Examples
| Input | Output |
|---|---|
|
4
|
3 5 1 11
|
Notes
In the example, the array \([3, 5, 1, 11]\) has length \(4\), all elements are distinct odd integers, and its sum is \(3 + 5 + 1 + 11 = 20\), which is exactly \(4 \cdot (4+1)\)Other answers would also be accepted.
Problem Info
| Problem ID | 790 |
| Time Limit | 1000 ms |
| Memory Limit | 128000 KB |
| Moderators | Ahad_41 |
Statistics
Submit
You need to Login or Registration for submit your solution