PRPOTION getting WA

what could be the reason my submission was:

Hey, if you look at the constraints, it is given:“1 ≤ r[i], g[i], b[i] ≤ 10^9”

but all your variables are of int type, so they cannot hold such large values, I suggest you use long int instead of int.

i changed every variable to long long then also getting wrong answer F3k2jA - Online C Compiler & Debugging Tool - Ideone.com

You did not understand the question properly.

In a single magic trick, she will choose a particular color. Then she will pick all the potions of the chosen color and decrease the amount of liquid in them to half

Read the above part of the question again.

If you want a test case check your code on this input:

1
3 2 2 2
1 2 3
2 8
9 10

The correct answer if 4 and your code gives 8.

2 Likes

i guess correct ans should be 5 instead.

1 Like

Yes the answer should be 5

First iteration - - > 9/2=4; 10/2=5

New Values:

1 2 3
2 8
4 5

Second Iteration - - >2/2=1; 8/2=4;

New Values:

1 2 3
1 4
4 5

And so Highest Value : 5

2 Likes

exactly…:slight_smile: