Problem p03599 (python)

Fixed submission:
inf=10**8
a,b,c,d,e,f=map(int,input().split())
a,b=100*a,100*b
DP=[inf]*(f+max(a,b)+1)
DP[a],DP[b]=0,0

for i in range(f+1):
    if DP[i]!=inf:
        DP[i+a]=DP[i]
        DP[i+b]=DP[i]
        for j in c,d:
            if 100*(DP[i]+j)/(i+j)<=100*e/(100+e):
                DP[i+j]=max(DP[i],DP[i]+j)

ans,index=0,[a,0]
for i in range(f+1):
    if DP[i]!=inf:
        if ans<100*DP[i]/i:
            ans=100*DP[i]/i
            index=[i,DP[i]]

print(*index)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
a,b=a*100,b*100

DP=[-1 for _ in range(f+1)]
DP[a],DP[b]=0,0
for i in range(f):
    if DP[i]==-1:continue
    for j in a,b:
        if i+j<=f:DP[i+j]=DP[i]
    for j in c,d:
        if i+j<=f and 100*(DP[i]+j)/(i+j)<=100*e/(100+e):
            DP[i+j]=DP[i]+j

ans,water=0,[a,0]
for i,j in enumerate(DP):
    if i==0 or j==-1:continue
    if ans<100*j/i:
        ans=100*j/i
        water=[i,j]
print(*water)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
a,b=a*100,b*100

DP=[-1 for _ in range(f+2)]
DP[a],DP[b]=0,0
for i in range(f+1):
    if DP[i]==-1:continue
    for j in a,b:
        if i+j<=f:DP[i+j]=DP[i]
    for j in c,d:
        if i+j<=f and 100*(DP[i]+j)/(i+j)<=100*e/(100+e):
            DP[i+j]=DP[i]+j

ans,water=0,[a,0]
for i,j in enumerate(DP):
    if i==0:continue
    if ans<100*j/i:
        ans=100*j/i
        water=[i,j]
print(*water)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
a,b=a*100,b*100

DP=[-1 for _ in range(f+1)]
DP[a],DP[b]=0,0
for i in range(f+1):
    if DP[i]==-1:continue
    for j in a,b:
        if i+j<=f:DP[i+j]=DP[i]
    for j in c,d:
        if i+j<=f and 100*(DP[i]+j)/(i+j)<=100*e/(100+e):
            DP[i+j]=DP[i]+j

ans,water=0,[a,0]
for i,j in enumerate(DP):
    if i==0:continue
    if ans<100*j/i:
        ans=100*j/i
        water=[i,j]
print(*water)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())
a *=100
b *=100

DP=[-1 for _ in range(f+1)]
DP[a],DP[b]=0,0
for i in range(f+1):
    if DP[i]==-1:continue
    for j in a,b:
        if i+j<=f:DP[i+j]=DP[i]
    for j in c,d:
        if i+j<=f and 100*(DP[i]+j)/(i+j)<=100*e/(100+e):
            DP[i+j]=DP[i]+j

ans,water=0,[a,0]
for i,j in enumerate(DP):
    if i==0:continue
    if ans<100*j/i:
        ans=100*j/i
        water=[i,j]
print(*water)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())

DP=[[0,0] for _ in range(f+100)]
DP[a*100][0]=a*100
DP[b*100][0]=b*100

for i in range(f+1):
    if DP[i][0]==0:continue
    for j in a,b:
        if i+j*100<=f:
            j *=100
            if DP[i][1]*100/(i+j)>=DP[i+j][1]*100/(i+j):
                DP[i+j]=[i+j,DP[i][1]]
    for j in c,d:
        if i+j<=f:
            if 100*(DP[i][1]+j)/(i+j)<=100*e/(100+e):
                if 100*(DP[i][1]+j)/(i+j)>=100*(DP[i+j][1])/(i+j):
                    DP[i+j]=[i+j,DP[i][1]+j]

ans,water=0,[a*100,0]
for x,y in DP:
    if x==0:continue
    if 100*y/x>ans:
        ans=100*y/x
        water=[x,y]
print(*water)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())

DP=[[0,0] for _ in range(f+1)]
DP[a*100][0]=a*100
DP[b*100][0]=b*100

for i in range(f+1):
    if DP[i][0]==0:continue
    for j in a,b:
        if i+j*100<=f:
            j *=100
            if DP[i][1]*100/(i+j)>=DP[i+j][1]*100/(i+j):
                DP[i+j]=[i+j,DP[i][1]]
    for j in c,d:
        if i+j<=f:
            if 100*(DP[i][1]+j)/(i+j)<=100*e/(100+e):
                if 100*(DP[i][1]+j)/(i+j)>=100*(DP[i+j][1])/(i+j):
                    DP[i+j]=[i+j,DP[i][1]+j]

ans,water=0,[a*100,0]
for x,y in DP:
    if x==0:continue
    if 100*y/x>ans:
        ans=100*y/x
        water=[x,y]
print(*water)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())

DP=[[0,0] for _ in range(f+1)]
DP[a*100][0]=a*100
DP[b*100][0]=b*100

for i in range(f+1):
    if DP[i][0]==0:continue
    for j in a,b:
        if i+j*100<=f:
            j *=100
            if DP[i][1]*100/(i+j)>=DP[i+j][1]*100/(i+j):
                DP[i+j]=[i+j,DP[i][1]]
    for j in c,d:
        if i+j<=f and 100*(DP[i][1]+j)/(i+j)<=100*e/(100+e):
            if 100*(DP[i][1]+j)/(i+j)>=100*(DP[i+j][1])/(i+j):
                DP[i+j]=[i+j,DP[i][1]+j]

ans,water=0,[a*100,0]
for x,y in DP:
    if x==0:continue
    if 100*y/x>ans:
        ans=100*y/x
        water=[x,y]
print(*water)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f=map(int,input().split())

DP=[[0,0] for _ in range(f+1)]
DP[a*100][0]=a*100
DP[b*100][0]=b*100

for i in range(f+1):
    if DP[i][0]==0:continue
    for j in a,b:
        if i+j*100<=f:
            j *=100
            if DP[i][1]*100/(i+j)>=DP[i+j][1]*100/(i+j):
                DP[i+j]=[i+j,DP[i][1]]
    for j in c,d:
        if i+j<=f and 100*(DP[i][1]+j)/(i+j)<=100*e/(100+e):
            if 100*(DP[i][1]+j)/(i+j)>=100*(DP[i+j][1])/(i+j):
                DP[i+j]=[i+j,DP[i][1]+j]

ans,water=0,[0,0]
for x,y in DP:
    if x==0:continue
    if 100*y/x>ans:
        ans=100*y/x
        water=[x,y]
print(*water)