LOLSUM
CodeChefOpen on judge ↗
Given an array $Arr$ followed by some queries For each query $q$ perform the following actions: - if $ q == 1$ insert given element at the end of array - if $ q == 2$ print the sum of all subarrays in the updated array Ex: $Arr$ = {1,2,3} Sum of all subarrays of $Arr$ = 20 all subarrays : {1} + {2} + {3} + {2 + 3} + {1 + 2} + {1 + 2 + 3} = 20 ### Input - First line will contain
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