Editorial for DMOPC '22 Contest 5 P1 - Triple Triplets
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:
It is optimal to use only the integers and in the array . Then, the Triple value will be equal to , where represents the number of s in the array, and represents the number of s in the array.
Subtask 1
This subtask was meant for suboptimal implementations of the full solution or brute forcing for each by hand.
Subtask 2
Loop over all possible values of and calculate the Triple value for each, taking the maximum value for the answer.
Time Complexity:
Comments