← All problemsSign in

Construct Array

CodeChefRating 1624Open on judge ↗

You are given a positive integer $N$. Consider an array $A$ of length $N$. Let $P_i$ denote the sum of the first $i$ elements of $A$ and $S_i$ denote the sum of the last $i$ elements of $A$. You need to construct the array $A$ of size $N$ such that all of the following conditions are met: - $-10^9 \leq A_i \leq 10^9$, for all $(1\le i \le N)$ - $P_i \gt S_i$ if $i$ is odd, for each $(1 \leq i \

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start