Gregor and the Odd Cows (Hard)

Problem Name:
Gregor and the Odd Cows (Hard)
Site:CodeForces
Links:
Tags:
Problem setters: