ah, neat! I love stuff like this.
This reminds me of a recent problem in Facebook's annual coding contest (hacker cup), where the insight is similarly to notice that you only need to characterize states by #s instead of by the specific set of players: https://www.facebook.com/codingcompetitions/hacker-cup/2020/...