How to solve Nasty Queries from May cook-off?

Problem link: https://www.codechef.com/problems/COOK82D

3 Likes

Nvm, got the editorial. Can the admin please link the editorial to the problem?
Editorial: https://discuss.codechef.com/questions/98591/cook82d-editorial

//