Last time C from today. I forgot to write it, so I only have one question.
#15 Problem
** Thoughts ** It is a similar subject to yesterday's B problem. TLE is prevented by reducing the for loop from three to two.
n ,y = map(int,input().split())
for i in range(n+1):
for j in range(n+1):
noguti = (y - (i * 10000 + j * 5000)) // 1000
if noguti + i + j == n and noguti >= 0:
print(i,j,noguti)
quit()
print(-1,-1,-1)
By the way, it was Python3 → 1567ms, PyPy3 → 276ms. PyPy strong
It was a similar subject to yesterday, so I was able to do it right away. There is a considerable speed difference between Python3 and PyPy3, so I think it's better to use PyPy for the for statement. see you
Recommended Posts