Magic Value
CodeChefOpen on judge ↗
Raghav is very much interested in puzzles that involves circles. He arranges $n$ positive numbers in a circle, where $n$ is odd. For two numbers to be called adjacent there is a rule. If there is $i$ such that $2 \leq i \leq n$, the elements $x[i−1]$ and $x[i]$ are considered to be adjacent, and $x[n]$ and $x[1]$ are also considered to be adjacent. In one operation, Raghav will be picking a number
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