There are n students S1; : : : ; Sn and m classes C1; : : : ;Cm. There is a bipartite graph on the students and the classes specifying which students can take which classes. Student Si needs to take at least ai classes. Class Cj can take at most bj students.
Give a poly(n;m)-time algorithm for assigning classes to students so that all these constraints are met.