Problem:


Score : 300 points

Problem Statement

Snuke is making sugar water in a beaker.
Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.

Operation 1: Pour 100A grams of water into the beaker.

Operation 2: Pour 100B grams of water into the beaker.

Operation 3: Put C grams of sugar into the beaker.

Operation 4: Put D grams of sugar into the beaker.

In our experimental environment, E grams of sugar can dissolve into 100 grams of water.

Snuke will make sugar water with the highest possible density.

The beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.
Find the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.
If there is more than one candidate, any of them will be accepted.

We remind you that the sugar water that contains a grams of water and b grams of sugar is \frac{100b}{a + b} percent.
Also, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.

Constraints

1 \leq A < B \leq 30

1 \leq C < D \leq 30

1 \leq E \leq 100

100A \leq F \leq 3 000

A, B, C, D, E and F are all integers.

Inputs

Input is given from Standard Input in the following format:

A B C D E F

Outputs

Print two integers separated by a space.
The first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.

Sample Input 1

1 2 10 20 15 200

Sample Output 1

110 10

In this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.

We can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.
It is not possible to make sugar water with higher density.
For example, the following sequences of operations are infeasible:

If we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.

If we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.

Sample Input 2

1 2 1 2 100 1000

Sample Output 2

200 100

There are other acceptable outputs, such as:

400 200

However, the output below is not acceptable:

300 150

This is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.

Sample Input 3

17 19 22 26 55 2802

Sample Output 3

2634 934



Sample input:
1 2 10 20 15 200


Sample output:
110 10

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

a,b,c,d,e,f = map(int,input().split())

max_water = f // 100 * a
max_sugar = f // c

water = []
for i in range(max_water):
    for j in range(max_water):
        water.append(100*a*i+100*b*j)

sugar = []
for i in range(max_sugar):
    for j in range(max_sugar):
        sugar.append(c*i+d*j)

answer = 0
anssugar = 0
answater = 0

for i in range(len(water)):
    for j in range(len(sugar)):
        if water[i] == 0 and sugar[j] == 0:
            continue
        con = 100 * sugar[j] / (water[i] + sugar[j])
        if answer < con and con <= e and sugar[j] + water[i] <= f :
            answer = con
            anssugar = sugar[j]
            answater = water[i]

print(answater+anssugar,anssugar)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F=map(int,input().split())
A*=100
B*=100
ans=(0,0)
Max=0
for a in range(1+F//A):
    F_a=F-a*A
    water_a=a*A
    for b in range(1+F_a//B):
        F_b=F_a-b*B
        water_b=water_a+b*B
        for c in range(1+F_b//C):
            suger_c=c*C
            if suger_c>E*water_b/100:break
            F_c=F_b-c*C
            d=min(F_c//D,(E*water_b//100-suger_c)//D)
            suger_d=suger_c+d*D
            if water_b+suger_d==0:continue
            if suger_d/(water_b+suger_d)>Max:
                Max=suger_d/(water_b+suger_d)
                ans=(water_b+suger_d,suger_d)
print(str(int(ans[0]))+' '+str(int(ans[1])))

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
conc = 0
answater = A
anssugar = 0


for i in range(1, F//(100*A)+1):
    for j in range(F//(100*A)+1):
        if 100*A*i+100*B*j>F:
            break
        for k in range(E*(A*i+B*j)+1):
            if 100*A*i+100*B*j+C*k>F or C*k>E*(A*i+B*j):
                    break
            for l in range(E*(A*i+B*j)+1):
                if 100*A*i+100*B*j+C*k+D*l>F or C*k+D*l>E*(A*i+B*j):
                    break
                tmp = 100*(C*k+D*l)/(100*A*i+100*B*j+C*k+D*l)
                if tmp > conc:
                    conc = tmp
                    answater = 100*A*i+100*B*j+C*k+D*l
                    anssugar = C*k+D*l

print(answater, anssugar)

Submission status: Wrong Answer

Solution code:
A, B, C, D, E, F = map(int, input().split())
conc = 0
answater = 0
anssugar = 0


for i in range(1, F//(100*A)+1):
    for j in range(F//(100*A)+1):
        if 100*A*i+100*B*j>F:
            break
        for k in range(E*(A*i+B*j)+1):
            if 100*A*i+100*B*j+C*k>F or C*k>E*(A*i+B*j):
                    break
            for l in range(E*(A*i+B*j)+1):
                if 100*A*i+100*B*j+C*k+D*l>F or C*k+D*l>E*(A*i+B*j):
                    break
                tmp = 100*(C*k+D*l)/(100*A*i+100*B*j+C*k+D*l)
                if tmp > conc:
                    conc = tmp
                    answater = 100*A*i+100*B*j+C*k+D*l
                    anssugar = C*k+D*l

print(answater, anssugar)

Submission status: Wrong Answer

Solution code:
from itertools import product

A, B, C, D, E, F = map(int, input().split())
conc = 0
answater = A
anssugar = 0

for i, j, k, l in product(range(1, 31), range(31), range(51), range(51)):
    if 100*A*i+100*B*j+C*k+D*l>F or C*k+D*l>E*(A*i+B*j):
        continue
    else:
        tmp = 100*(C*k+D*l)/(100*(A*i+B*j)+C*k+D*l)
        if tmp > conc:
            conc = tmp
            answater = 100*(A*i+B*j)+C*k+D*l
            anssugar = C*k+D*l

print(answater, anssugar)

Submission status: Wrong Answer

Solution code:
from itertools import product

A, B, C, D, E, F = map(int, input().split())
conc = 0
answater = 100
anssugar = 0


for i, j, k, l in product(range(1, 31), range(31), range(51), range(51)):
    if 100*A*i+100*B*j+C*k+D*l>F or C*k+D*l>E*(A*i+B*j):
        continue
    else:
        tmp = 100*(C*k+D*l)/(100*(A*i+B*j)+C*k+D*l)
        if tmp > conc:
            conc = tmp
            answater = 100*(A*i+B*j)+C*k+D*l
            anssugar = C*k+D*l

print(answater, anssugar)

Submission status: Wrong Answer

Solution code:
from itertools import product

A, B, C, D, E, F = map(int, input().split())
conc = 0
answater = 0
anssugar = 0


for i, j, k, l in product(range(1, 31), range(31), range(51), range(51)):
    if 100*A*i+100*B*j+C*k+D*l>F or C*k+D*l>E*(A*i+B*j):
        continue
    else:
        tmp = 100*(C*k+D*l)/(100*(A*i+B*j)+C*k+D*l)
        if tmp > conc:
            conc = tmp
            answater = 100*(A*i+B*j)+C*k+D*l
            anssugar = C*k+D*l

print(answater, anssugar)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

max_sw = 100 * a
max_s = 0
x = f // (a * 100)
for i in range(x + 1):
    q = f - i * a * 100
    if q < 0:
        break
    y = q // (b * 100)
    for j in range(y + 1):
        r = q - j * b * 100
        if r < 0:
            break
        z = r // c
        for k in range(z + 1):
            s = r - k * c
            if s < 0:
                break
            w = s // d
            for l in range(w + 1):
                t = s - l * d
                if t >= 0:
                    water = i * a * 100 + j * b * 100
                    sugar = k * c + l * d
                    if water > 0 and sugar / water * 100 <= e:
                        density = sugar / (sugar + water)
                        if density >= max_s / max_sw:
                            max_s = sugar
                            max_sw = sugar + water
                else:
                    break
print("{} {}".format(max_sw, max_s))

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

max_sw = 100 * a
max_s = 0
x = f // (a * 100)
for i in range(x + 1):
    q = f - i * a * 100
    y = q // (b * 100)
    y = -1 if y < 0 else y
    for j in range(y + 1):
        r = q - j * b * 100
        z = r // c
        z = -1 if z < 0 else z
        for k in range(z + 1):
            s = r - k * c
            w = s // d
            w = -1 if w < 0 else w
            for l in range(w + 1):
                t = s - l * d
                if t >= 0:
                    water = i * a * 100 + j * b * 100
                    sugar = k * c + l * d
                    if water > 0 and sugar / water * 100 <= e:
                        density = sugar / (sugar + water)
                        if density >= max_s / max_sw:
                            max_s = sugar
                            max_sw = sugar + water
                else:
                    break
print("{} {}".format(max_sw, max_s))

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

max_sw = 1
max_s = 0
x = f // (a * 100)
for i in range(x + 1):
    q = f - i * a * 100
    y = q // (b * 100)
    y = -1 if y < 0 else y
    for j in range(y + 1):
        r = q - j * b * 100
        z = r // c
        z = -1 if z < 0 else z
        for k in range(z + 1):
            s = r - k * c
            w = s // d
            w = -1 if w < 0 else w
            for l in range(w + 1):
                t = s - l * d
                if t >= 0:
                    water = i * a * 100 + j * b * 100
                    sugar = k * c + l * d
                    if water > 0 and sugar / water * 100 <= e:
                        density = sugar / (sugar + water)
                        if density >= max_s / max_sw:
                            max_s = sugar
                            max_sw = sugar + water
                else:
                    break
print("{} {}".format(max_sw, max_s))

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int,input().split())

water = 0
sugar = 0
rate = 0

for x in range(31):
    for y in range(31):
        if x + y == 0:
            continue
        for z in range(101):
            for w in range(101):
                now_water = 100*a*x + 100*b*y + c*z + d*w
                if now_water > f:
                    break
                now_sugar = c*z + d*w
                if now_water*e >= now_sugar*(100 + e):
                    now_rate = now_sugar/now_water
                    if rate < now_rate:
                        rate = now_rate
                        water = now_water
                        sugar = now_sugar

print(water,sugar)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int,input().split())

water = 0
sugar = 0
rate = 0

for x in range(31):
    for y in range(31):
        if x + y == 0:
            continue
        for z in range(100):
            for w in range(100):
                now_water = 100*a*x + 100*b*y + c*z + d*w
                if now_water > f:
                    break
                now_sugar = c*z + d*w
                if now_water*e >= now_sugar*(100 + e):
                    now_rate = now_sugar/now_water
                    if rate < now_rate:
                        rate = now_rate
                        water = now_water
                        sugar = now_sugar

print(water,sugar)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    A = list(map(int, input().split()))

    wat1 = A[0] * 100
    wat2 = A[1] * 100
    sug1 = A[2]
    sug2 = A[3]
    max_conc = A[4]
    max_volume = A[5]

    W = set()
    for i in range(31):
        for j in range(31):
            w = wat1 * i + wat2 * j
            if w <= max_volume:
                W.add(w)

    S = set()
    for i in range(3001):
        for j in range(3001):
            s = sug1 * i + sug2 * j
            if s <= max_volume:
                S.add(s)

    vol = 0
    suger = 0
    conc = 0
    for w in W:
        if w == 0:
            continue
        for s in S:
            cur_conc = s / (w / 100)
            if cur_conc > max_conc:
                continue

            cur_conc = 100 * s / (w + s)
            if cur_conc > conc and w+s <= max_volume:
                conc = cur_conc
                vol = w + s
                suger = s

    print(vol, suger)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    A = list(map(int, input().split()))

    wat1 = A[0] * 100
    wat2 = A[1] * 100
    sug1 = A[2]
    sug2 = A[3]
    max_conc = A[4]
    max_volume = A[5]

    W = set()
    for i in range(31):
        for j in range(31):
            w = wat1 * i + wat2 * j
            if w <= max_volume:
                W.add(w)

    S = set()
    for i in range(101):
        for j in range(101):
            s = sug1 * i + sug2 * j
            if s <= max_volume:
                S.add(s)

    vol = 0
    suger = 0
    conc = 0
    for w in W:
        if w == 0:
            continue
        for s in S:
            cur_conc = s / (w / 100)
            if cur_conc > max_conc:
                continue

            cur_conc = 100 * s / (w + s)
            if cur_conc > conc and w+s <= max_volume:
                conc = cur_conc
                vol = w + s
                suger = s

    print(vol, suger)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    A = list(map(int, input().split()))

    wat1 = A[0] * 100
    wat2 = A[1] * 100
    sug1 = A[2]
    sug2 = A[3]
    max_conc = A[4]
    max_volume = A[5]


    W = set()
    for i in range(31):
        for j in range(31):
            w = wat1 * i + wat2 * j
            if w <= max_volume:
                W.add(w)

    S = set()
    for i in range(101):
        for j in range(101):
            s = sug1 * i + sug2 * j
            if s <= max_volume:
                S.add(s)

    water = 0
    suger = 0
    conc = 0
    for w in W:
        if w == 0:
            continue
        for s in S:
            cur_conc = s / (w / 100)
            if cur_conc > max_conc:
                continue

            if cur_conc > conc and w+s <= max_volume:
                conc = cur_conc
                water = w
                suger = s

    print(water+suger, suger)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
mizu = 0
satou = 0
noudo = 0
for i in range(0,F//(100*A)+1):
  for j in range(0,F//(100*B)+1):
    curmizu = (A*i+B*j)*100
    for k in range(0,(curmizu*E//(100*C))+1):
      for l in range(0,(curmizu*E//(100*D))+1):
        cursatou = k*C+l*D
        if curmizu+cursatou <= F:
          if cursatou <= curmizu*E/100:
            if curmizu+cursatou != 0:
              if 100*(cursatou)/(curmizu+cursatou) > noudo:
                mizu = curmizu
                satou = cursatou
                noudo = 100*(cursatou)/(curmizu+cursatou)
print(mizu+satou,satou)

Submission status: Wrong Answer

Solution code:
A,B,C,D,E,F = map(int,input().split())
mizu = 0
satou = 0
noudo = 0
for i in range(0,F//(100*A)+1):
  for j in range(0,F//(100*B)+1):
    curmizu = (i+j)*100
    for k in range(0,(curmizu*E//(100*C))+1):
      for l in range(0,(curmizu*E//(100*D))+1):
        cursatou = k*C+l*D
        if curmizu+cursatou <= F:
          if cursatou <= curmizu*E/100:
            if curmizu+cursatou != 0:
              if 100*(cursatou)/(curmizu+cursatou) > noudo:
                mizu = curmizu
                satou = cursatou
                noudo = 100*(cursatou)/(curmizu+cursatou)
print(mizu+satou,satou)

Submission status: Wrong Answer

Solution code:
def sugar_water(A: int, B: int, C: int, D: int, E: int, F: int)->tuple:
    max_dens = 0
    min_a, min_b, min_c, min_d = 0, 0, 0, 0
    for a in range(F//(100*A) + 1):
        for b in range((F-100*A*a)//(100*B) + 1):
            for c in range((F-100*A*a-100*B*b)//C + 1):
                for d in range((F-100*A*a-100*B*b-c*C)//D + 1):
                    if F < 100*A*a + 100*B*b + c + d:
                        continue
                    if E * (100*a*A + 100*b*B) < (c*C + d*D) * 100:
                        continue
                    if a == 0 and b == 0 and c == 0 and d == 0:
                        continue

                    dens = (c*C + d*D) / (100*a*A + 100*b*B + c*C + d*D)

                    if max_dens < dens:
                        min_a, min_b, min_c, min_d = a, b, c, d
                        max_dens = dens
    return 100*A*min_a + 100*B*min_b + C*min_c + D*min_d, C*min_c + D*min_d


if __name__ == "__main__":
    A, B, C, D, E, F = map(int, input().split())
    w, s = sugar_water(A, B, C, D, E, F)
    print(w, s)

Submission status: Wrong Answer

Solution code:
def sugar_water(A: int, B: int, C: int, D: int, E: int, F: int)->tuple:
    max_dens = 0
    min_a, min_b, min_c, min_d = 0, 0, 0, 0
    for a in range(F//(100*A) + 1):
        for b in range((F-100*A*a)//(100*B) + 1):
            for c in range((F-100*A*a-100*B*b)//C + 1):
                for d in range((F-100*A*a-100*B*b-c)//D + 1):
                    if F < 100*A*a + 100*B*b + c + d:
                        continue
                    if E * (100*a*A + 100*b*B) < (c*C + d*D) * 100:
                        continue
                    if a == 0 and b == 0 and c == 0 and d == 0:
                        continue

                    dens = (c*C + d*D) / (100*a*A + 100*b*B + c*C + d*D)

                    if max_dens < dens:
                        min_a, min_b, min_c, min_d = a, b, c, d
                        max_dens = dens
    return 100*A*min_a + 100*B*min_b + C*min_c + D*min_d, C*min_c + D*min_d


if __name__ == "__main__":
    A, B, C, D, E, F = map(int, input().split())
    w, s = sugar_water(A, B, C, D, E, F)
    print(w, s)

Submission status: Wrong Answer

Solution code:

def main():
    A,B,C,D,E,F = map(int,input().split())

    x_list = []
    for i in range(F+1):
        for j in range(F+1):
            x = 100*A*i + 100*B*j
            if x <= F:
                x_list.append(x)

    y_list = []
    for i in range(F+1):
        for j in range(F+1):
            y = i*C + j*D
            if y <= F:
                y_list.append(y)

    res = 0
    res_x = 0
    res_y = 0

    x_list = list(set(x_list))
    y_list = list(set(y_list))

    for x in x_list:
        for y in y_list:
            if x + y > F:
                continue

            if y == 0:
                tmp = 0
                res_x = x
                res_y = y
            else:
                tmp = y/(x+y)

            if tmp > E/(100+E):
                continue

            if res < tmp:
                res = tmp
                res_x = x
                res_y = y


    print(res_x+res_y,res_y)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:

def main():
    A,B,C,D,E,F = map(int,input().split())

    x_list = []
    for i in range(F+1):
        for j in range(F+1):
            x = 100*A*i + 100*B*j
            if x <= F:
                x_list.append(x)

    y_list = []
    for i in range(F+1):
        for j in range(F+1):
            y = i*C + j*D
            if y <= F:
                y_list.append(y)

    res = 0
    res_x = 0
    res_y = 0

    x_list = list(set(x_list))
    y_list = list(set(y_list))

    for x in x_list:
        for y in y_list:
            if x + y > F:
                continue

            if y == 0:
                tmp = 0
            else:
                tmp = y/(x+y)

            if tmp > E/(100+E):
                continue

            if res < tmp:
                res = tmp
                res_x = x
                res_y = y


    print(res_x+res_y,res_y)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

if a*100 + c > f:
    ans1, ans2 = a*100, 0
else:
    ans1, ans2 = a*100+c, c
    check = 100*c/(a*100+c)
    water = []
    for i in range(int(f/100)+1):
        for j in range(int(f/100)+1):
            if a*i*100 + b*j*100 <= f:
                water.append(a*i*100 + b*j*100)
    water.sort()
    sugar = []
    for i in range(int(f/c)+1):
        for j in range(int(f/d)+1):
            if c*i+(c*i)*e/100 + d*j+(d*j)*e/100 <= f:
                sugar.append(c*i + d*j)
    sugar.sort(reverse=True)
    for w in list(set(water)):
        if w > 0:
            for s in list(set(sugar)):
                if w+s <= f and s <= w*e/100:
                    if check < 100*s/(w+s):
                        check = 100*s/(w+s)
                        ans1, ans2 = w+s, s
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

if a*100 + c > f:
    ans1, ans2 = a, 0
else:
    ans1, ans2 = a*100+c, c
    check = 100*c/(a*100+c)
    water = []
    for i in range(int(f/100)+1):
        for j in range(int(f/100)+1):
            if a*i*100 + b*j*100 <= f:
                water.append(a*i*100 + b*j*100)
    water.sort()
    sugar = []
    for i in range(int(f/c)+1):
        for j in range(int(f/d)+1):
            if c*i+(c*i)*e/100 + d*j+(d*j)*e/100 <= f:
                sugar.append(c*i + d*j)
    sugar.sort(reverse=True)
    for w in list(set(water)):
        if w > 0:
            for s in list(set(sugar)):
                if w+s <= f and s <= w*e/100:
                    if check < 100*s/(w+s):
                        check = 100*s/(w+s)
                        ans1, ans2 = w+s, s
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

if a*100 + c > f:
    ans1, ans2 = a, 0
else:
    ans1, ans2 = a*100+c, c
    check = 100*c/(a*100+c)
    water = []
    for i in range(int(f/100)+1):
        for j in range(int(f/100)+1):
            if i*100 + j*100 <= f:
                water.append(i*100 + j*100)
    water.sort()
    sugar = []
    for i in range(int(f/c)+1):
        for j in range(int(f/d)+1):
            if c*i+(c*i)*e/100 + d*j+(d*j)*e/100 <= f:
                sugar.append(c*i + d*j)
    sugar.sort(reverse=True)
    for w in list(set(water)):
        if w > 0:
            for s in list(set(sugar)):
                if w+s <= f and s <= w*e/100:
                    if check < 100*s/(w+s):
                        check = 100*s/(w+s)
                        ans1, ans2 = w+s, s
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

if a*100 + c > f or c > e:
    ans1, ans2 = a, 0
else:
    ans1, ans2 = a*100+c, c
    check = 100*c/(a*100+c)
    water = []
    for i in range(1, int(f/100)):
        if a*i*100 < f:
            water.append(a*i*100)
        if b*i*100 < f:
            water.append(b*i*100)
        for j in range(1, int(f/100)):
            if a*i*100+b*i*100 < f:
                water.append(a*i*100+b*j*100)
    water.sort()
    sugar = []
    for i in range(1, int(f/c)+1):
        if c*i+(c*i)*e/100 < f:
            sugar.append(c*i)
        if d*i+(d*i)*e/100 < f:
            sugar.append(d*i)
        for j in range(1, int(f/c)+1):
            if c*i+(c*i)*e/100 + d*i+(d*i)*e/100 < f:
                sugar.append(c*i + d*j)
    sugar.sort(reverse=True)
    for w in list(set(water)):
        for s in list(set(sugar)):
            if w+s <= f and s <= w*e/100:
                if check < 100*s/(w+s):
                    check = 100*s/(w+s)
                    ans1, ans2 = w+s, s
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

if a*100 + c > f:
    ans1, ans2 = a, 0
else:
    ans1, ans2 = a*100+c, c
    check = 100*c/(a*100+c)
    water = []
    for i in range(1, int(f/100)):
        if a*i*100 < f:
            water.append(a*i*100)
        if b*i*100 < f:
            water.append(b*i*100)
        for j in range(1, int(f/100)):
            if a*i*100+b*i*100 < f:
                water.append(a*i*100+b*j*100)
    water.sort()
    sugar = []
    for i in range(1, int(f/c)+1):
        if c*i+(c*i)*e/100 < f:
            sugar.append(c*i)
        if d*i+(d*i)*e/100 < f:
            sugar.append(d*i)
        for j in range(1, int(f/c)+1):
            if c*i+(c*i)*e/100 + d*i+(d*i)*e/100 < f:
                sugar.append(c*i + d*j)
    sugar.sort(reverse=True)
    for w in list(set(water)):
        for s in list(set(sugar)):
            if w+s <= f and s <= w*e/100:
                if check < 100*s/(w+s):
                    check = 100*s/(w+s)
                    ans1, ans2 = w+s, s
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

ans1, ans2 = a*100+c, c
check = 100*c/(a*100+c)
water = []
for i in range(1, int(f/100)):
    if a*i*100 < f:
        water.append(a*i*100)
    if b*i*100 < f:
        water.append(b*i*100)
    for j in range(1, int(f/100)):
        if a*i*100+b*i*100 < f:
            water.append(a*i*100+b*j*100)
water.sort()
sugar = []
for i in range(1, int(f/c)+1):
    if c*i+(c*i)*e/100 < f:
        sugar.append(c*i)
    if d*i+(d*i)*e/100 < f:
        sugar.append(d*i)
    for j in range(1, int(f/c)+1):
        if c*i+(c*i)*e/100 + d*i+(d*i)*e/100 < f:
            sugar.append(c*i + d*j)
sugar.sort(reverse=True)
for w in list(set(water)):
    for s in list(set(sugar)):
        if w+s <= f and s <= w*e/100:
            if check < 100*s/(w+s):
                check = 100*s/(w+s)
                ans1, ans2 = w+s, s
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
a, b, c, d, e, f = map(int, input().split())

ans1, ans2 = a*100+c, c
check = 100*c/(a*100+c)
water = []
for i in range(1, int(f/100)):
    if a*i*100 < f:
        water.append(a*i*100)
    if b*i*100 < f:
        water.append(b*i*100)
water.sort()
sugar = []
for i in range(1, int(f/c)+1):
    if c*i+(c*i)*e/100 < f:
        sugar.append(c*i)
    if d*i+(d*i)*e/100 < f:
        sugar.append(d*i)
sugar.sort(reverse=True)
for w in water:
    for s in sugar:
        if w+s <= f and s <= w*e/100:
            if check < 100*s/(w+s):
                check = 100*s/(w+s)
                ans1, ans2 = w+s, s
print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/23
Solved on 2019/3/
@author: shinjisu
"""


# ABC 074 C - Sugar Water

def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替
class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def conc(maxconc, water, sugar):
    global E, F
    #db = Debug()
    #db.off()
    if water == 0:
        return 0
    conc = sugar / (sugar+water*100) * 100
    #db.dmp((maxconc, water, sugar, conc),'maxconc, water, sugar, conc')
    if sugar/water > E:  # not all melted
        #db.dmp('not all melted')
        return -11
    elif water*100+sugar > F:  # overflow
        #db.dmp('overflow')
        return -5
    elif conc > maxconc:
        #db.dmp('MAX UPDATED')
        return conc
    else:
        return -1


def prob():
    global E, F
    db = Debug()
    db.off()
    A, B, C, D, E, F = getIntList()
    db.dmp((A, B, C, D, E, F), 'A, B, C, D, E, F')
    a = F // (100 * A)
    b = F // (100 * B)
    c = F // C
    d = F // D
    db.dmp((a, b, c, d), 'a, b, c, d')
    maxConc, maxWater, maxSugar = -1.0, 0, 0
    for i in range(a+1):
        for j in range(b+1):
            water = A*i + B*j
            if water*100 >= F:  # overflow
                break
            for n in range(c+1):
                for m in range(d+1):
                    sugar = C*n + D*m
                    cn = conc(maxConc, water, sugar)
                    if cn > 0:
                        maxConc, maxWater, maxSugar = cn, water, sugar
                    elif cn < -10:
                        break

    db.dmp((maxConc, maxWater, maxSugar),'max conc, water, sugar')
    return maxWater*100+maxSugar, maxSugar


ans = prob()
for elm in ans:
    print(elm, end=' ')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/23
Solved on 2019/3/
@author: shinjisu
"""


# ABC 074 C - Sugar Water

def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替
class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def conc(maxconc, water, sugar):
    global E, F
    db = Debug()
    db.off()
    if water == 0:
        return 0
    conc = sugar / (sugar+water*100) * 100
    db.dmp((maxconc, water, sugar, conc),'maxconc, water, sugar, conc')
    if sugar/water > E:  # not all melted
        db.dmp('not all melted')
        return -11
    elif water*100+sugar > F:  # overflow
        db.dmp('overflow')
        return -5
    elif conc > maxconc:
        db.dmp('MAX UPDATED')
        return conc
    else:
        return -1


def prob():
    global E, F
    db = Debug()
    db.off()
    A, B, C, D, E, F = getIntList()
    db.dmp((A, B, C, D, E, F), 'A, B, C, D, E, F')
    a = F // (100 * A)
    b = F // (100 * B)
    c = F // C
    d = F // D
    db.dmp((a, b, c, d), 'a, b, c, d')
    maxConc, maxWater, maxSugar = -1.0, 0, 0
    for i in range(0, a+1):
        for j in range(0, b+1):
            water = A*i + B*j
            if water*100 >= F:  # overflow
                break
            for n in range(0, c+1):
                for m in range(0, d+1):
                    sugar = C*n + D*m
                    cn = conc(maxConc, water, sugar)
                    if cn > 0:
                        maxConc, maxWater, maxSugar = cn, water, sugar
                    elif cn < -10:
                        break

    db.dmp((maxConc, maxWater, maxSugar),'max conc, water, sugar')
    return maxWater*100+maxSugar, maxSugar


ans = prob()
for elm in ans:
    print(elm, end=' ')