GCD Returns
CodeChefOpen on judge ↗
You are given array of $n$ element and one integer $x$ $(x \le n)$. you have to select $x$ elements form array such that GCD of selected $x$ element is maximize. ###Input: - First line of input in number of testcases $t$ $(1 \le t \le 10)$. - First line of each testcase contain two integer $n$ and $x$ $(1 \le x \le n \le 10^5)$. - Second line of each testcase contain array of $n$ elements
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