Editorial for DMOPC '18 Contest 5 P3 - A Familiar Problem
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
For the first subtask, we can iterate over all subarrays
Time Complexity:
For the second subtask, we can find the sum in
Time Complexity:
For the third subtask, we can use a 2-pointer approach. As the right pointer advances, the left pointer should point to the left-most index where the sum is less than
Time Complexity:
Comments