Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
import numpy as np

Q, H, S, D = map(int, input().split())
values = np.array([min(min(2*Q, H), S), D])

capacities = np.array([1.0, 2.0])
eval = values / capacities
N = int(input())
nums = np.zeros(2)

sorted_eval_index = np.argsort(eval)

# N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n

for index in list(sorted_eval_index):
    if N/capacities[index] >= 1:
        nums[index] += int(N/capacities[index])
        N -= nums[index] * capacities[index]

print(int(np.sum(values*nums)))

import numpy as np

Q, H, S, D = map(int, input().split())
# values = np.array([min(2*min(2*Q, H), S), D])

# capacities = np.array([1.0, 2.0])
# eval = values / capacities
N = int(input())

#
# sorted_eval_index = np.argsort(eval)
#
# # N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n
#
# for index in list(sorted_eval_index):
#     if N/capacities[index] >= 1:
#         nums[index] += int(N/capacities[index])
#         N -= nums[index] * capacities[index]
#
# print(int(np.sum(values*nums)))

print(int(N/2*(min(2*min(2*min(2*Q, H), S), D))+(N % 2)*(min(2*min(2*Q, H), S))))

import numpy as np

Q, H, S, D = map(int, input().split())
values = np.array([Q, H, S, D])

capacities = np.array([0.25, 0.5, 1.0, 2.0])
eval = values / capacities
N = int(input())
nums = np.zeros(4)

sorted_eval_index = np.argsort(eval)

# N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n

N_last = N

for index in list(sorted_eval_index):
    if N/capacities[index] >= 1:
        nums[index] += int(N/capacities[index])
        N -= nums[index] * capacities[index]

print(np.sum(values*nums))

import numpy as np

Q, H, S, D = map(int, input().split())
# values = np.array([min(2*min(2*Q, H), S), D])

# capacities = np.array([1.0, 2.0])
# eval = values / capacities
N = int(input())

# 
# sorted_eval_index = np.argsort(eval)
# 
# # N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n
# 
# for index in list(sorted_eval_index):
#     if N/capacities[index] >= 1:
#         nums[index] += int(N/capacities[index])
#         N -= nums[index] * capacities[index]
# 
# print(int(np.sum(values*nums)))

print(N/2*(min(2*min(2*min(2*Q, H), S), D))+(N % 2)*(min(2*min(2*Q, H), S)))

import numpy as np

Q, H, S, D = map(int, input().split())
values = np.array([min(min(2*Q, H), S), D])

capacities = np.array([1.0, 2.0])
eval = values / capacities
N = int(input())
nums = np.zeros(2)

sorted_eval_index = np.argsort(eval)

print(capacities)
print(values)
print(sorted_eval_index)

# N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n

for index in list(sorted_eval_index):
    if N/capacities[index] >= 1:
        nums[index] += int(N/capacities[index])
        N -= nums[index] * capacities[index]

print(int(np.sum(values*nums)))

import numpy as np

Q, H, S, D = map(int, input().split())
# values = np.array([min(2*min(2*Q, H), S), D])

# capacities = np.array([1.0, 2.0])
# eval = values / capacities
N = int(input())

#
# sorted_eval_index = np.argsort(eval)
#
# # N = 0.25 * Q_n + 0.5 * H_n + 1 * S_n + 2 * D_n
#
# for index in list(sorted_eval_index):
#     if N/capacities[index] >= 1:
#         nums[index] += int(N/capacities[index])
#         N -= nums[index] * capacities[index]
#
# print(int(np.sum(values*nums)))

print(int(int(N/2)*(min(2*min(2*min(2*Q, H), S), D))+(N % 2)*(min(2*min(2*Q, H), S))))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted