Crying colors codechef long january 2022 solution || codechef long challange || CRYCOLR solution
Crying Colours Problem Code: CRYCOLR You have a total of 3 N 3 N balls of colours R e d R e d , B l u e B l u e and G r e e n G r e e n . There are exactly N N balls of each colour. These 3 N 3 N balls are now distributed to 3 3 boxes such that each box contains exactly N N balls. You are given the contents of each box. You would like the 1 s t 1 s t box to contain all the red balls, the 2 n d 2 n d box to contain all the green balls, and the 3 r d 3 r d box to contain all the blue balls. Note that the given order of boxes is important here — it is not enough for each box to contain only balls of a single colour. To achieve this, you can perform the following operation several (possibly, zero) times: Pick any two distinct boxes, pick any one ball from each of these two boxes, and swap them. Determine the minimum nu...