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

ans = 0
a = 0
res = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] 
score = [(i+1)*100 for i in range(n-1, -1, -1)] 
howmany = [List[i][0] for i in range(n-1, -1, -1)]

while(ans + max_score[a] <= g):
    ans += max_score[a]
    a += 1

for i in range(a):
    res += howmany[i]
    
rest = g - ans
x = -(-rest // score[a])
    
#print(max_score)
#print(score)
#print(howmany)
#print(res)
print(res + x)

n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

ans = []

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] 
score = [(i+1)*100 for i in range(n-1, -1, -1)] 
howmany = [List[i][0] for i in range(n-1, -1, -1)] 

for i in range(2**n):
    s = 0
    m = 0
    max = 0 
    for j in range(n):
        if((i >> j) & 1):
            max += 1
            s += max_score[j]
            m += howmany[j]
    if(s >= g):
        ans.append(m)
    else:
        if(max < n):
            print(m)
            rest = g - s
            k = rest // score[max] 
            if(k < howmany[max]):
                m += k
                ans.append(m)
        
print(ans)
print(min(ans))

n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

pre_ans = 0
ans = 0
a = 0
res = 0
x = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] 
score = [(i+1)*100 for i in range(n-1, -1, -1)] 
howmany = [List[i][0] for i in range(n-1, -1, -1)] 

while(ans <= g):
    pre_ans = ans
    ans += max_score[a]
    a += 1
    
for i in range(a):
    res += howmany[i]
    
rest = g - ans
#x = -(-rest // score[a])
if rest > 0:
    x = rest // score[a]

#print(max_score)
#print(score)
#print(howmany)
#print(res)
#print(x)
print(res + x)

n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in rage(n)]

ans = 0
a = 0
res = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] 
score = [(i+1)*100 for i in range(n-1, -1, -1)] 

while(ans + max_score[a] <= g):
    ans += max_score[a]
    a += 1

for i in range(a):
    res += List[n - a][0]
    
rest = g - ans
x = -(-rest // score[a])
    
print(res + x)

n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

ans = 0
a = 0
res = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] 
score = [(i+1)*100 for i in range(n-1, -1, -1)] 

while(ans + max_score[a] <= g):
    ans += max_score[a]
    a += 1

for i in range(a):
    res += List[n - a][0]
    
rest = g - ans
x = -(-rest // score[a])
    
print(res + x)

n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

ans = []

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] 
score = [(i+1)*100 for i in range(n-1, -1, -1)] 
howmany = [List[i][0] for i in range(n-1, -1, -1)] 

for i in range(2**n):
    s = 0
    m = 0
    max = 0 
    for j in range(n):
        if((i >> j) & 1):
            max += 1
            s += max_score[j]
            m += howmany[j]
    if(s >= g):
        ans.append(m)
    else:
        if(max < n):
            rest = g - s
            k = -(-rest // score[max]) 
            if(k < howmany[max]):
                m += k
                ans.append(m)

print(min(ans))

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted