← All problemsSign in

Strange Functions

While playing with arrays, Ira came across this problem. You are given an array A[0..N-1]. You are needed to compute 2 functions F and G. They are defined as follows. - F[i] = A[i]2 +(∑ G[j])2 where (i&j) = j and j - G[i] = (∑ F[j]2) where (i&j) = j and j ≤ i You need to print the summation (∑ i × F[i] × G[i]) mod 109+7. Note : Here & denotes bitwise and operator. Input - First line

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