Range Modulus
CodeChefOpen on judge ↗
Given an array of length N containing integers A1, A2, A3, ... AN . Given m queries of the form (l,r) find the maximum length of continuous subsequence (Ai, Ai+1, ...Aj) such that l ≤ i ≤ j ≤ r and (Ai + Ai+1 + Ai+2 + ... Aj) mod k = 0. Input First line of input contains three numbers N,m,k - length of array, number of queries, and number used to take modulus with. Next line will contain N in
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