 I was also doing the same mistake. Try your code for TC: 2 2 2 5
It will give 7 as the answer but the correct answer is 6.
Intead use this code for n=4
ans = min(max((v + v), (v + v)), max(v, v+v+v));

1 Like

I was also doing the same mistake. Try your code for TC: 2 2 2 5
It will give 7 as the answer but the correct answer is 6.
Instead use this code for n=4
ans = min(max((v + v), (v + v)), max(v, v+v+v));

1 Like
``````if (checkSame(timings)) {
timeToReady = (numberOfDishes % 2 == 0) ? timings * (numberOfDishes / 2)
: (timings * (numberOfDishes / 2)) + timings;
} else {
timeToReady = (totalTime % 2 == 0) ? totalTime / 2 : (totalTime / 2) + 1;
}
``````

this returns the actual correct answer. but still show WA . someone please explain why? or official answer is wrong?

here is my solution https://www.codechef.com/viewsolution/39680213

thanks player007,you are right, i got my mistake.
The above code will fail for 5222 test case

@player007 thankyou , it worked .

Is something wrong with the interface. I am getting SIGSTP errors on my code. I tried copy-pasting a code which was successfully submitted. It still throws the same error.

can somebody help me with EOF error in Python … i dont know why in every question i am getting error. I have choosen python 3.6

I have a different approach for this problem.
Approach of SUBSEQUENCES.
Suppose we have dishes time as 1,2,3,4. Total time sum is 8. And Solution for every problem will be T/2+something. For this we find sum of different subsequences and find sum which is minimum but is greater than 4 or equal to 4. Here 1,3 subsequence sum is 4 So answer is 4.
Same for exp 2,2,2 . In this nearest subsequence sum to 3 is 4. So Answer is 4.
Solution got accepted. Hope u like this approach.

SUBSEQUENCES help us to get all possible combination of dishes and then we can simply compare.

The output for 2 3 4 5 is 9, not 7.