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())
p = [0]*D
c = [0]*D
ans = 10**9
for i in range(D):
    p[i], c[i] = map(int,input().split())

for j in range(2**D):
    total_score = 0
    solved_problems = 0
    unsolved = []
    for k in range(D):
        if (j>>k)&1:
            total_score += 100*(k+1)*p[k]+c[k]
            solved_problems += p[k]
        else:
            unsolved.append(k)
    #print(unsolved)
    if unsolved:
        unsolved_idx = max(unsolved)
        if 100*(unsolved_idx+1)*(p[unsolved_idx]-1) + total_score < G:
            continue
        for l in range(p[unsolved_idx]):
            if (l+1)*100*(unsolved_idx+1) + total_score >= G:
                solved_problems += l+1
                if solved_problems < ans:
                    ans = solved_problems
                break
    else: #all solved
        if solved_problems < ans:
            ans = solved_problems

print(ans)

D, G = map(int,input().split())
p = [0]*D
c = [0]*D
ans = 10**9
for i in range(D):
    p[i], c[i] = map(int,input().split())

for j in range(2**D):
    total_score = 0
    solved_problems = 0
    unsolved = []
    for k in range(D):
        if (j>>k)&1:
            total_score += 100*(k+1)*p[k]+c[k]
            solved_problems += p[k]
        else:
            unsolved.append(k)
    #print(unsolved)
    if unsolved:
        unsolved_idx = max(unsolved)
        if 100*(unsolved_idx+1)*(p[unsolved_idx]-1) + total_score < G:
            continue
        for l in range(p[unsolved_idx]):
            if (l+1)*100*(unsolved_idx+1) + total_score > G:
                solved_problems += l+1
                if solved_problems < ans:
                    ans = solved_problems
                break
    else: #all solved
        if solved_problems < ans:
            ans = solved_problems

print(ans)

D,G = map(int,input().split())
p = [0]*D
c = [0]*D
for i in range(D):
    p[i], c[i] = map(int,input().split())

ans = float('inf')

for bit in range(1 << D):
    temp_score = 0
    solved_num = 0
    uncompleted_idx = -1
    for i in range(D):
        if (bit & (1<<i)):
            temp_score += p[i]*100*(i+1) + c[i] 
            solved_num += p[i]
        else:
            uncompleted_idx = max(uncompleted_idx,i)


    if G <= temp_score:
        ans = min(ans,solved_num)
        continue
    
    if uncompleted_idx == -1:
        continue

    for j in range(p[uncompleted_idx]):
        temp_score += 100*(uncompleted_idx+1)
        solved_num += 1
        if G <= temp_score:
            ans = min(ans,solved_num)
            break
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted