Codechef bella ciao

https://www.codechef.com/JUNE21C/problems/CHFHEIST Hey i am unable to build the logic of Q in this question . I mean how can we increase Q according to the rate given

hello @soumyabhardwaj75

you are not allowed to ask questions from running contests.