Please help to understand this editorial (PCJ18G) chef and pizza

https://discuss.codechef.com/t/pcj18g-editorial/19733