Problem: The restaurant AtCoder serves the following five dishes:    * ABC Don (rice bowl): takes A minutes to serve.   * ARC Curry: takes B minutes to serve.   * AGC Pasta: takes C minutes to serve.   * APC Ramen: takes D minutes to serve.   * ATC Hanbagu (hamburger patty): takes E minutes to serve.  Here, the time to serve a dish is the time between when an order is placed and when the dish is delivered.  This restaurant has the following rules on orders:    * An order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).   * Only one dish can be ordered at a time.   * No new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.  E869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.   Here, he can order the dishes in any order he likes, and he can place an order already at time 0.

Submission attempts (in order):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

menu = [a, b, c, d, e]

time = 0
count = 0
for i in range(5):
    if menu[i] % 10 == 0:
        tmp = menu[count]
        menu[count] = menu[i]
        menu[i] = tmp
        count += 1
           

while True:
    flg = 0
    for i in range(4-count):
        num1 = menu[i+count]
        num2 = menu[i+count+1]
        if num1 % 10 < num2 % 10:
            menu[i+count] = num2
            menu[i+count+1] = num1
            flg = flg + 1
    if flg == 0:
        break


for i in range(4):
    time += (menu[i]+ (10-menu[i]%10))
time += menu[4]
print(time)


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

menu = [a, b, c, d, e]

time = 0
count = 0
for i in range(5):
    if menu[i] % 10 == 0:
        tmp = menu[count]
        menu[count] = menu[i]
        menu[i] = tmp
        count += 1
           

while True:
    flg = 0
    for i in range(4-count):
        num1 = menu[i+count]
        num2 = menu[i+count+1]
        if num1 % 10 < num2 % 10:
            menu[i+count] = num2
            menu[i+count+1] = num1
            flg = flg + 1
    if flg == 0:
        break
print(menu)

for i in range(5):
    time += menu[i]


a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

menu = [a, b, c, d, e]

time = 0
count = 0
for i in range(5):
    if menu[i] % 10 == 0:
        tmp = menu[count]
        menu[count] = menu[i]
        menu[i] = tmp
        count += 1
           

while True:
    flg = 0
    for i in range(4-count):
        num1 = menu[i+count]
        num2 = menu[i+count+1]
        if num1 % 10 < num2 % 10:
            menu[i+count] = num2
            menu[i+count+1] = num1
            flg = flg + 1
    if flg == 0:
        break
print(menu)

for i in range(4):
    time += (menu[i])
    if menu[i] % 10 == 0:
        time += 10-menu[i]%10 
time += menu[4]
print(time)


time = 0
order_list = []

for i in range(5):
        order_list.append(int(input()))


order_list = sorted(order_list, key=lambda x: ((x-1)%10), reverse=True)

for i in order_list[0:-1]:
        if i % 10 == 0:
                time += i
        else:
                time += (int(i/10)+1)*10

print(time+order_list[-1])
        

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted