USACO 2019 US Open Contest, Gold Problem 2. I Would Walk 500 Miles
Farmer John wants to divide his NN cows (N≤7500)(N≤7500), conveniently numbered 1…N1…N, into KK non-empty groups (2≤K≤N2≤K≤N) such that no two cows from two different groups can interact with each ...