WA in HIRINGWO

Hey! multiplying minimum elements will not always work, you have to generate possible partitions and choose optimally. If we take K=2 and x=210, we have 2,3,5,7 as prime factors, here your code code gives 37 (2x3x5+7) but we can have much optimal answer 29(5x3+2x7). An easy brute force method for getting optimal partition is given in editorial’s thread here.

1 Like