← All problemsSign in

Maximum number, GCD condition

CodeChefRating 2169Open on judge ↗

Statement You will be given an array A of N integers. You need to answer M queries. Each query is of the form G x y. For each query, construct the set S from A. A[i] is included in S if x i y and GCD(G,A[i]) > 1. Let MAX be the maximum number present in S. Output MAX and number of occurances of MAX in S. If no such number exists, output "-1 -1" (without quotes). Input The first line of the inp

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