So Straight
Given 2 arrays A, B (1-indexed) each having length N. There are 2 types of queries. You have to handle Q of them. - Type 1 : 1 L Add the subarray B1, B2, B3 ... BN-L+1 to AL, AL+1, AL+2 ... AN respectively. i.e. Add B1 to AL, B2 to AL+1 ... BN-L+1 to AN. - Type 2 : 2 L R Print the sum AL + AL+1 + AL+2 + ... AR Input Format: First line of the input contains two space separated 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