https://www.codechef.com/COOK107B/problems/SLUSH

https://www.codechef.com/COOK107B/problems/SLUSH

please tell me the approach for the question?