October Magical Girl Question (Example not clear)

Can anyone explain me the the example 3rd , How the answer of this 3rd example is 5?

Problem statement : http://www.codechef.com/OCT14/problems/PRPOTION

We have :- {(1, 2, 3) , (2, 4) , (6, 8)}
Steps:

  1. Dividing 2nd set -> {(2, 3, 4) , (1, 2) , (7, 9)}
  2. Dividing 1st set -> {(1, 1, 2) , (2, 3) , (8, 10)}
  3. Dividing 3rd set -> {(2, 2, 3) , (3, 4) , (4, 5)}

At the third step we have max liquid = 5 :slight_smile:

@ankit_kumar
How you chose 2nd set 1st ,
it should be 3rd na
B/c maximum liquid we can reduce in third set first

So my doubt is which set to choose when?

@n1n1_4 That’s the thing you need to find :stuck_out_tongue:

But on what basis we are choosing the set?
At least you can tell me that?

the last test case allowed only 2 steps right so how do you have 3 in your explanation ?

3 Likes

Why 3 times division???

I think “at most” thing plays role here. We can perform magical tricks at most equal to 2 or less than that.

Magic trick is performed just once. Dividing 3rd set -> {(2,3,4),(3,5),(3,4)}

In one step, we get maximum liquid as 5. But, again this is hell lot of confusion! -_-

And now, they have changed the answer to 4. I cannot make up any more plots to get the answer. This time the contest is highly messed up.

Well this is just a hell! Not a clear explanation and when I finally made the logic they changed the problem! What the Hell