Here is the link to my submission…
https://www.codechef.com/viewsolution/25996305
Please someone explain me the error in it…
Give me some testcase where my code fails.
THANKS in advance.
i think, on line 24;
if(temp>l and temp<=r)
should be changed to
if(temp>=l and temp<=r)
as question says inclusive in range. Also i don’t know much python, but i think this should work.
WrongSolution
Can’t figure out whats wrong with my code. Am I missing something? Please help.
in loop of 0 to m;
you forget to add one more else if condition.
adding this might work,
else if(temp>=k-1 && temp<=k+1) temp = k;
By mistake i posted wrong link to my solution,
I have changed it now…
Thanks man, It worked.
feeling silly, how can I make such mistakes :\
We are humans, it happens.
Pls see my new link and tell me where it fails
I submitted my code with inclusive only in first attempt…
Sorry but i don’t know much python. I hope someone else might help you.
in line 20 --> temp -=1
Yup Thanks…I made a mistake in shorthand operator
https://www.codechef.com/viewsolution/26009981
Can anyone please tell why my code is giving wrong answer ? Please provide the test case it is failing
It’s possible that the final output takes the value 10^6. Consider the case when n = 1, m = 1, k = 1, l = 1, r = 1, temperature of coke can = 1, price of coke can = 1000000. Your program will output -1 where it should be outputting 1000000.
Thank you so much ! It worked