Editorial for Bubble Cup V8 C Party
                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.
To explain solution of this problem let's describe the scheme of Hungarian algorithm:
Hungarian()
{
    for (int i = 0; i < n; i++)
    {
        hungarian_iteration();
    }
}
So in this problem the only thing you had to do is to recursively go through all sets of binary masks with equal number of s and 
s (where 
 in 
 position means that 
 person would go partying on Friday, 
 – Saturday) and run Hungarian algo for this matrix. If done recursively complexity would be 
. DP cannot be used here because of low ML.
Comments