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
D, G = map(int,input().split())
plist = [ list( map(int ,input().split())) for i in range(D)]

print(plist)

bit = [0,1]
'''
(0, 0, 0, 0, 0)
(0, 0, 0, 0, 1)
(0, 0, 0, 1, 0)
(0, 0, 0, 1, 1)
(0, 0, 1, 0, 0)
(0, 0, 1, 0, 1)
(0, 0, 1, 1, 0)
(0, 0, 1, 1, 1)
(0, 1, 0, 0, 0)
(0, 1, 0, 0, 1)
(0, 1, 0, 1, 0)
(0, 1, 0, 1, 1)
(0, 1, 1, 0, 0)
(0, 1, 1, 0, 1)
(0, 1, 1, 1, 0)
(0, 1, 1, 1, 1)
(1, 0, 0, 0, 0)
(1, 0, 0, 0, 1)
(1, 0, 0, 1, 0)
(1, 0, 0, 1, 1)
(1, 0, 1, 0, 0)
(1, 0, 1, 0, 1)
(1, 0, 1, 1, 0)
(1, 0, 1, 1, 1)
(1, 1, 0, 0, 0)
(1, 1, 0, 0, 1)
(1, 1, 0, 1, 0)
(1, 1, 0, 1, 1)
(1, 1, 1, 0, 0)
(1, 1, 1, 0, 1)
(1, 1, 1, 1, 0)
(1, 1, 1, 1, 1)

'''
answerList = []
for i in range(D):
    answerList.append([plist[i][0], 100* (i+1) + plist[i][1]])


solutionList = itertools.product(bit, repeat=D)
result = []
for solutionTupple in itertools.product(bit, repeat=D):
    tmp = [0,0]
    maxIndex = -1
    for i in range(D):
        if solutionTupple[i] == 1:
            tmp[0] += answerList[i][0]
            tmp[1] += answerList[i][1]
        if solutionTupple[i] == 0 :
            maxIndex = max(maxIndex,i)
            
    result.append(tmp)
    
    if maxIndex == -1:
        break
    for i in range(answerList[maxIndex][0]):
        a = tmp[0] + i + 1
        b = tmp[1] + (i + 1) * (i+1) * 100
        result.append([a,b])
answer = float('inf')
for r in result:
    if r[1] > G:
        answer = min(answer,r[0])
 
print(answer)

import itertools
D, G = map(int,input().split())
plist = [ list( map(int ,input().split())) for i in range(D)]

#print(plist)

bit = [0,1]
'''
(0, 0, 0, 0, 0)
(0, 0, 0, 0, 1)
(0, 0, 0, 1, 0)
(0, 0, 0, 1, 1)
(0, 0, 1, 0, 0)
(0, 0, 1, 0, 1)
(0, 0, 1, 1, 0)
(0, 0, 1, 1, 1)
(0, 1, 0, 0, 0)
(0, 1, 0, 0, 1)
(0, 1, 0, 1, 0)
(0, 1, 0, 1, 1)
(0, 1, 1, 0, 0)
(0, 1, 1, 0, 1)
(0, 1, 1, 1, 0)
(0, 1, 1, 1, 1)
(1, 0, 0, 0, 0)
(1, 0, 0, 0, 1)
(1, 0, 0, 1, 0)
(1, 0, 0, 1, 1)
(1, 0, 1, 0, 0)
(1, 0, 1, 0, 1)
(1, 0, 1, 1, 0)
(1, 0, 1, 1, 1)
(1, 1, 0, 0, 0)
(1, 1, 0, 0, 1)
(1, 1, 0, 1, 0)
(1, 1, 0, 1, 1)
(1, 1, 1, 0, 0)
(1, 1, 1, 0, 1)
(1, 1, 1, 1, 0)
(1, 1, 1, 1, 1)

'''
answerList = []
for i in range(D):
    answerList.append([plist[i][0], 100 * (i+1) * plist[i][0] + plist[i][1]])


solutionList = itertools.product(bit, repeat=D)
result = []

for i,solutionTupple in enumerate(itertools.product(bit, repeat=D)):
    if i == 0:
        for j in range(answerList[D-1][0]-1):
            a = j + 1
            result.append([j+1, D * 100 * (j + 1)])
        continue

    tmp = [0,0]
    maxIndex = -1
    for i in range(D):
        if solutionTupple[i] == 1:
            tmp[0] += answerList[i][0]
            tmp[1] += answerList[i][1]
        if solutionTupple[i] == 0:
            maxIndex = max(maxIndex, i)

    result.append(tmp)
    #print(solutionTupple)

    if maxIndex == -1:
        break
    for i in range(answerList[maxIndex][0]-1):
        a = tmp[0] + i + 1
        b = tmp[1] + (i + 1) * (maxIndex+1) * 100
        result.append([a,b])
#print(answerList)
#print(result)
answer = float('inf')
for r in result:
    if r[1] >= G:
        answer = min(answer,r[0])

print(answer)


Verdicts: Wrong Answer

Accepted