← All problemsSign in

RANGEGCD

You are given an array of $N$ positive integers. All the numbers in the array are powers of 2. Given $Q$ queries $q_1, q_2, \cdots, q_Q$, consider all the ranges $l_j, r_j$ such that $r_j-l_j=q_i$. For each query find a range, $l_p$ and $r_p$ such that $r_p - l_p = q_i$ and the GCD of all the numbers in the range is the maximum amongst all such ranges that follow the restriction. Note : You only

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