CF Problems: 2020 Jan. ~ Feb.

Matroid Intersection: 1284G
The problem asks us to find a spanning tree where certian nodes cannot be leaves. The key thing to think about is “What does it mean to be non-leaves?”, and the idea is that the total degree of a node is at least 2. Therefore, we can try to find an acyclic edge set where the degree of each special node is exactly 2. This can be done using intersection of a graphic matroid and a colorful matroid (We restrict each color to have at most two instances, and check whether it is exactly 2 in the final maximum independent set).