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):
d,g = map(int,input().split())
pc = [[int(i) for i in input().split()] for j in range(d)]

num = 2**d

score = 0
ans = 0


def nokori(use,score):
    tmp = 0
    for i in range(d):
        if d-1-i not in use:
            if pc[d-1-i][0] * (d-1-i+1) * 100 >= score:
                tmp += (score +(d-1-i+1) * 100 - 1) // ( (d-1-i+1) * 100 )
                return tmp
            elif pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1] >= score:
                tmp += pc[d-1-i][0]
                return tmp
            else:
                tmp += pc[d-1-i][0]
                score -= pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1]
kouho = []

kouho.append(nokori([-1],g))
#exit()

for i in range(num):
    use = []
    for j in range(d):
        if num % 2 == 0:
            score += pc[j][0] * (j+1) * 100 + pc[j][1]
            ans += pc[j][0]
            use.append(j)
        else:
            continue
        num = num // 2
    if score >= g:
        kouho.append(ans)
    else:
        kouho.append(ans+nokori(use,d-score))


kouho.sort()
print(kouho[0])


d,g = map(int,input().split())
pc = [[int(i) for i in input().split()] for j in range(d)]

num = 2**d

score = 0
ans = 0

use = [0,1]

def nokori(use,score):
    tmp = 0
    for i in range(d):
        #print(use, d-1-i, d-1-i not in use)
        if d-1-i not in use:
            if pc[d-1-i][0] * (d-1-i+1) * 100 >= score:
                tmp += (score +(d-1-i+1) * 100 - 1) // ( (d-1-i+1) * 100 )
                return tmp
            elif pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1] >= score:
                tmp += pc[d-1-i][0]
                return tmp
            else:
                tmp += pc[d-1-i][0]
                score -= pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1]
kouho = []

kouho.append(nokori([-1],g))
#exit()

for i in range(num):
    use = []
    ans = 0
    score = 0
    cur = i
    #print(i)
    for j in range(d):
        if cur == 0:
            continue
        elif cur% 2 == 1:
            #print(i % 2,j)
            score += pc[j][0] * (j+1) * 100 + pc[j][1]
            ans += pc[j][0]
            use.append(j)
            #print(use,j,cur)
        #else:
            #cur -= 1
            #continue
        cur = cur // 2
    #print(use,i)
    if score >= g:
        kouho.append(ans)
    else:
        #print(use)
        #print(ans,score)
        kouho.append(ans+nokori(use,g-score))
        


kouho.sort()
print(kouho[0])


Verdicts: Wrong Answer

Accepted