Editorial for LCC '21 Contest 1 J3 - Candy Collecting


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: AlanL

A brute force solution can be used to solve this problem.

Use a boolean array to keep track of which endings have been visited already, and two integer arrays to keep track of which ending the entrances lead to, and what their values are, respectively.

To check which entrances to pick, use a nested for loop to go through all possible combinations of entrances to go through, and take the maximum value achieved from this.

Be aware of edge cases, like cases where you can only go through 1 or 0 paths.


Comments

There are no comments at the moment.