Problem: A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode.  A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements:    * Base score: the sum of the scores of all problems solved by the user.   * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).  Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective?

Submission attempts (in order):
import itertools
n, g = map(int, input().split())
L = []
for i in range(n):
    t = list(map(int, input().split()))
    
    t.append((i+1)*100)
    L.append(t)
print(n, g, L)

ans = 100 * n
for v in itertools.permutations(L):
    print(v)
    score = 0
    count = 0
    k = 0
    p = v[k][0]
    while score < g:
        score += v[k][2]
        p -= 1 # v[k][0] -= 1
        count += 1
        if p == 0: # v[k][0] == 0:
            score += v[k][1]
            k += 1
            if k < n:
                p = v[k][0]
        print(v,count,score,k,p)
    ans = min(ans, count)
print(ans)


# P = []
# G = []

#     s, t = map(int, input().split())
#     P.insert(0, s)
#     G.insert(0, t//100)
# score = 0

# count = 0
# while score < g:
#     count += 1
#     if 1 in P:
#         j = P.index(1)
#         score += n-j + G[j]
#         P[j] = 0
#         if j == k:

#     else:
#         score += n-k
#         P[k] -= 1
#     print(P,G,score,count,k)
# print(count)

import itertools
n, g = map(int, input().split())
L = []
for i in range(n):
    t = list(map(int, input().split()))
    
    t.append((i+1)*100)
    
    t.append((i+1)*100*t[0]+t[1])
    L.append(t)
print(L)




# ans = 100 * n
# for v in itertools.permutations(L):
#     score = 0
#     count = 0

#     p = v[k][0]
#     while score < g:
#         score += v[k][2]
#         p -= 1
#         count += 1
#         if p == 0:
#             score += v[k][1]


#                 p = v[k][0]
#     ans = min(ans, count)
# print(ans)


# P = []
# G = []

#     s, t = map(int, input().split())
#     P.insert(0, s)
#     G.insert(0, t//100)
# score = 0

# count = 0
# while score < g:
#     count += 1
#     if 1 in P:
#         j = P.index(1)
#         score += n-j + G[j]
#         P[j] = 0
#         if j == k:

#     else:
#         score += n-k
#         P[k] -= 1
#     print(P,G,score,count,k)
# print(count)

import itertools
n, g = map(int, input().split())
L = []
for i in range(n):
    t = list(map(int, input().split()))
    
    t.append((i+1)*100)
    
    t.append((i+1)*100*t[0]+t[1])
    L.append(t)
# print(L)

ans = g//100

for i in range(2**n):
    count = 0
    score = 0
    m = 0
    for j in range(n):
        if (i >> j) & 1:
            score += L[j][3]
            count += L[j][0]
        else:
            m = j
    # print(bin(i), m, score, count)
    if score >= g:
        ans = min(ans, count)
    else: 
        if (g - score)/L[m][2] <= L[m][0] and (g - score)%L[m][2] == 0:
            count += (g - score)//L[m][2]
        elif (g - score)/L[m][2] + 1 <= L[m][0]:
            count += ((g - score)//L[m][2])+1
        else:
            count = g//100
        ans = min(ans, count)
    # print(bin(i), m, L[m], score, count)
print(ans)


# ans = 100 * n
# for v in itertools.permutations(L):
#     score = 0
#     count = 0

#     p = v[k][0]
#     while score < g:
#         score += v[k][2]
#         p -= 1
#         count += 1
#         if p == 0:
#             score += v[k][1]


#                 p = v[k][0]
#     ans = min(ans, count)
# print(ans)


# P = []
# G = []

#     s, t = map(int, input().split())
#     P.insert(0, s)
#     G.insert(0, t//100)
# score = 0

# count = 0
# while score < g:
#     count += 1
#     if 1 in P:
#         j = P.index(1)
#         score += n-j + G[j]
#         P[j] = 0
#         if j == k:

#     else:
#         score += n-k
#         P[k] -= 1
#     print(P,G,score,count,k)
# print(count)

Verdicts: Wrong Answer

Wrong Answer

Accepted