Set To Max (Hard Version)

Problem Name:
Set To Max (Hard Version)
Site:CodeForces
Links:
Tags:
Problem setters: