J - Make Equal Under Mod
CodeChefOpen on judge ↗
You have an array $A$ consisting of $N$ integers. You can do the following operation as many times as you want: - Choose $i$ and $X$ satisfying $1 \le i \le N$ and $1 \le X \le 10^7$, and change $A_i$ to $A_i \bmod X$ It can be proven that it is possible to make all elements of $A$ equal. Let $f(A)$ denote the maximum possible value of $A_1$ after all the elements of $A$ have been made equal.
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.
Sign in to chat with the tutor and save your progress.
Sign in to start