← All problemsSign in

Dot Time

CodeChefRating 2765Open on judge ↗

You are given a sequence of integers $A_1, A_2, \ldots, A_N$ and an integer $M$. For any valid integers $p, q$, let's define $F(p, q)$ as the dot product of the subsequences $A_p, A_{p+1}, \ldots, A_{p+M-1}$ and $A_q, A_{q+1}, \ldots, A_{q+M-1}$, i.e. $F(p, q) = \sum_{i=0}^{M-1} A_{p+i} \cdot A_{q+i}$. You should process $Q$ queries. In each query: - You are given two integers $pos$ and $va

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