My python3 program’s result for this problem.
Please simply link to your submission, rather than taking a screenshot of it and telling us what your code does (although it’s great that you described the high-level logic of it :))
was seeing a similar pattern - AC on the second subtasks, but TLE on the (more constrained) first subtask. Maybe something to do with the number of testcases? Dunno
Even I havent figured it out why (I faced the same problem)
So I just went with a bruteforce approach when l<=10 (Subtask 1)
It worked so I am not complaining !
Hey, Can you help me with this one
Getting wrong answer for some cases.
compute the recipe to whom it belongs in linear time.
calculate the numerator part of solution and denominator part of solution for the final ratio.
multiply result variable with numerator and divide by denominator to take care of overflow.
oh i guess you were lucky for me found my bug. Thanks :)
Glad to help XD