Editorial for Baltic OI '11 P2 - Ice Cream
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 solution to ice cream is a simple brute force approach: loop over all triples of flavors, then check whether a forbidden pair is contained in the triple. The check can be done efficiently by storing the forbidden pairs in an array.
Complexity:
Comments