Editorial for I Hate Ready to Program P2 - Graphics Galore


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.

Author: Iaminnocent4298

Subtask 1

This can be solved using brute force.

Subtask 2

This question requires the use of a PSA (Prefix Sum Array).


Comments

There are no comments at the moment.