Editorial for Mock CCC '18 Contest 5 S5 - California Boggle
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.
The intended solution is network flow - the intuition here is to match up a C
to an A
, an A
to an L
, and an L
to an I
.
We connect each pair of adjacent letters that could be part of a valid match, and connect every C
to the source and every I
to the sink. The final
detail is to ensure that every node can only be used in one augmenting path.
Comments