Cat Party (Hard Edition)

Problem Name:
Cat Party (Hard Edition)
Site:CodeForces
Links:
Tags:
Problem setters: