can someone tell what those three testcases 6,7,9 could possibly look like, link to my solution here
Thanks for the shortened code but the result’s still the same. Am I missing something?
I did something very similar in the beginning and got all test cases correct but then next day went for a recheck and a test case was wrong and then I started overthinking on it …That is Sad…
Sorry i couldn’t understand there is some error with smallCountries values,
i ammended your code and got AC.
https://www.codechef.com/viewsolution/35618932
i did it little the way i actually did in contest.
hey even i got 6,7,9 wrong test cases, but for your test case i get answer as 4 can u check my solution here
Thank you for helping me out.
This worked for me as well. But what were the test cases that we missed? OR Why did we add this 2*, i didn’t get it yet. Can you please tell the logic behind this **2 ** * p[i] >= x ?
Can someone tell me the answer of this test case?
1
2 4
7 14
The problem is accepting 3 as the answer whereas the answer should be 4.
- If you give 4 cures in day 1, next day you can give only 6 cures because population becomes (7-4)*2=6. so in day 2 you can give 6 cures. On day 3, you can give 12 cures which is less than 14 so total 4 days is required. In no ways you can give all 7 cures in second day.
Try:
1
2 10
9 18
Ans: 2
On the day 2 you can send delivery man to 2nd country and can give 8 cures.
It means for second country you require 2 days because population is 14 so the answer is still 4
[CodeChef: Practical coding for everyone]
Can someone find error in my code. 2 test cases failing.Can somebody give me a failed test case…
A very simple solution:
https://www.codechef.com/viewsolution/35417013
see line number 22 to 47
Only 2 if conditions inside the for loop used to iterate sorted array.
WHY ll= x/2+x%2 ; why not ll=x ??
sorry i was wrong …my bad 
on first day we send our delivery man to second country now we have 8 vaccine, ( 7 infected in country 1st and 14 infected in country 2nd) ,then on second day we send him to 1st country now we have 14 vaccine ( 0 infected in 1st country and 14 in 2nd country) , on third day we send him to cure 2nd country. I hope it’s clear now.
In subtask 2, it think it should be 2 * Ai >= x .
I presume you are asking if we can deliver to that country if 2*a_i=x. Yes, we can. We can deliver to that country while doubling x or at the end. Either way it accounts for only 1 day for that country. My algorithm choses to deliver at the end.
I get you. Even I was thinking the same, I know many have done just hit and trail. I tried to get a proof and I submitted it assuming maximum population will always have enough people to be cured so that we can every time double supply for some country having less population.
@sudipandatta can you provide me some valid argument to prove ?
it’d be helpful