← All problemsSign in

Zero Permutation Score

CodeChefRating 1143Open on judge ↗

Chef has an array $A$ of length $N$, initially: $A_1 = A_2 = \cdots = A_N = 0.$ Chef wants to transform this array into a permutation of the integers ${1, 2, \dots, N}$. Chef may perform the following operation any number of times: - Select an index $i$ such that $1 \le i \le N$. - Update the value: $A_i := A_i + 1$. After every operation, compute $Z$ as follows: - $Z$ is the number of indice

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