← All problemsSign in

Equalization

CodeChefRating 2162Open on judge ↗

Bob has an array consisting of N integers. He wants to perform a sequence of operations after which all the numbers in the array will be equal. Each operation consists of choosing any prime integer P. Bob then chooses any P numbers from the array and replaces each of them by the arithmetic mean of these P numbers (leaving them at the same places in the array as before this operation). Note 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