Hi! I'm currently training for a programming competation and I'm stuck at a task, I got a solution but its not optimal:
from copy import copy
def main():
N, M = map(int, input().split())
sutok_limits = list(map(int, input().split()))
sutok = copy(sutok_limits)
j = 0
while M >= 0:
for i in range(N):
if sutok[i] > 1:
sutok[i] -= 1
else:
sutok[i] = sutok_limits[i]
M -= 1
j += 1
print(j)
main()
the problem is that someone is waiting in a queue for his food and there are N ovens and M people before him, (sutok means ovens in my language) and in the next lime I read the times for each oven to cook the food for a person (everyone orders the same food)