Given a value of
Input Specification
Line
Line
Line
Output Specification
An integer, on a single line - the least coins required to make change for
Sample Input
Copy
24
4
12
13
5
6
Sample Output
Copy
2
Given a value of
Line
Line
Line
An integer, on a single line - the least coins required to make change for
24
4
12
13
5
6
2
Comments
When I submit in PyPy3, I get IR (failed initialising), but the same code runs in Python 3, though I do get a TLE. What is happening?
PyPy is faster than CPython, but uses more memory. Since the memory limit is 16MB, PyPy3 is not suitable (or necessary) for this problem.
Your TLE solution is recursive, and is slower than your iterative AC solution.
Thank you!
My algorithm was wrong and yet I got 100% AC...?
The maximum value of
is 
.
According to the problem author, it is always possible to make change for x.