← All problemsSign in

Not Divisible

CodeChefRating 1363Open on judge ↗

You are given a positive integer $N$. Construct an array $A$ of length $N$ such that: - $-300 \leq A_i \leq 300$ - $|A_i + A_{i+1} + A_{i+2} + \ldots + A_j|$ is **not divisible** by $(j-i+1)$ for all pairs $(i,j)$ $(1 \leq i \lt j \leq N)$. Note that $|X|$ denotes the absolute value of $X$. For example $|-2|=2$ and $|5| = 5$. If multiple such arrays exist, print any. It is guaranteed that t

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