This is an abstraction of a problem that has come up in my research.
Imagine we have $N$ wizards and $N$ hats. The hats have $C$ different colours. There are $n_1>0$ hats with the first colour, $n_2>0$ with the second and so on such that $\sum_{i=1}^C n_i=N$. Hats of the same colour are identical in all respects.
Wizards are powerless without their hat and have magical power $0$. Each hat provides a power up to a wizard. How each coloured hat affects a wizard varies from wizard to wizard. We can think of the wizards as the integers $1,\dots,N$ and each coloured hat as a function $f_i:[N]\to\mathbb N$ where $f_i(m)$ is the magical power of wizard $m$ when wearing any hat with colour $i$.
Question: For which $C$ can we find an efficient algorithm that assigns an allocation of hats to wizards such that each wizard wears one hat and their total power is maximised?
In other words, can we find a colouring $i:[N]\to[C]$, with $n_i$ instances of colour $i$, such that $\sum_{m=1}^N f_{i(m)}(m)$ is maximised?
For $C=1$ this is trivial, while $C=2$ is very similar to the Neyman-Pearson lemma with $f_1-f_2$ the likelihood function ratio. The optimal solution for $C=2$ is given by $\{$wizards wearing hat 1$\}=\{m\mid f_1(m)-f_2(m)>k\}$ with $k$ chosen such that this set is of size $n_1$ (there's a subtlety when there is no $k$ such that this is true due to collisions of $f_1-f_2$, but this is simple to solve). However, for $C=3$ I have no idea how to proceed and am not even sure if the problem is in P.