Editorial for COCI '14 Contest 7 #3 ACM


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.

For each of the six possible permutations of the team members (first, second, third) the problem is solved using dynamic programming. The state consists of the task we are currently on and the team member (first, second or third) whom the previous task has been assigned to. When making a transition, we choose if we want to assign the current task to the same or the next team member. Dynamic programming can be implemented recursively, using memoization. Of course, an iterative implementation is also possible.


Comments

There are no comments at the moment.