Chef and Sums
Chef gave you a sequence of integers $a_1, a_2, \dots, a_N$ and $3$ integers $K$, $m$ and $x$. Let's define the following functions: $$G(i_1, \ldots, i_K) = \mathrm{gcd}\left(a_{i_1}, \dots, a_{i_K}\right)$$ $$S_x(i_1, \ldots, i_K) = a_{i_1}^x + a_{i_2}^x + \ldots + a_{i_K}^x$$ $$P_m(i_1, \ldots, i_K) = \left(a_{i_1} \cdot a_{i_2} \cdot \ldots \cdot a_{i_K}\right)^m$$ $$W(T) = \mathrm{smallest\,\,
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