Problem:


Score : 300 points

Problem Statement

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?

Constraints

1 ≤ D ≤ 10

1 ≤ p_i ≤ 100

100 ≤ c_i ≤ 10^6

100 ≤ G

All values in input are integers.

c_i and G are all multiples of 100.

It is possible to have a total score of G or more points.

Input

Input is given from Standard Input in the following format:

D G
p_1 c_1
:
p_D c_D

Output

Print the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).

Sample Input 1

2 700
3 500
5 800

Sample Output 1

3

In this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.

One way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.

Sample Input 2

2 2000
3 500
5 800

Sample Output 2

7

This case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.

Sample Input 3

2 400
3 500
5 800

Sample Output 3

2

This case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.

Sample Input 4

5 25000
20 1000
40 1000
50 1000
30 1000
1 1000

Sample Output 4

66

There is only one 500-point problem, but the perfect bonus can be earned even in such a case. 



Sample input:
2 700
3 500
5 800


Sample output:
3

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
D,G = [int(i) for i in input().rstrip().split(' ')]
P = []
for i in range(1,D+1):
    p,c = [int(i) for i in input().rstrip().split(' ')]
    P += [[i*100,p,c+p*i*100]]
P = P[::-1]
C = []
#print(P)
for start in range(D):
    p,c = 0,0
    for i in range(start,D):
        p += P[i][2]
        c += P[i][1]
        #print(start, i, p,c)
        if p >= G:
            l = (G - p + P[i][2] - 1) // P[i][0] + 1
            if l > G:
                l = G
            c += l - P[i][1]
            #print(P[i][0],G - p + P[i][2],l)
            C += [c]
            #print(c)
            break
print(min(C))

Submission status: Wrong Answer

Solution code:
d, g = map(int,input().split())
plist = [list(map(int,input().split())) for i in range(d)]

basiclist = []

problem = []

for i in range(len(plist)):
    tmplist = [plist[i][0], (plist[i][0])*(i+1)*100+plist[i][1]]
    problem.append(plist[i][0])
    basiclist.append(tmplist)

# print(basiclist)

import itertools

combs = []

for i in range(1, len(problem)+1):
    els = [list(x) for x in itertools.combinations(problem, i)]
    combs.extend(els)

# print(combs)

mincount = 2**10+1


for i in range (d):
    for j in range (1, basiclist[i][0]):
        if j*(i+1)*100 >= g:
            mincount = min(mincount, j)


for comb in combs:
    remaininglist=basiclist.copy()
    for basic in basiclist:
        if len(remaininglist) + len(comb) == len(basiclist):
            break
        if basic[0] in comb:
            remaininglist.remove(basic)
    best_remaining_score = len(remaininglist)*100
    total_ps = 0
    for com in comb:
        tmp = 0
        for basic in basiclist:
            if com == basic[0]:
                if basic[1] > tmp:
                    tmp = basic[1]
        total_ps += tmp
    # print(total_ps)
    if len(remaininglist) == 0:
        mincount = min(mincount, sum(comb))
        continue
    for i in range(remaininglist[-1][0]):
        if total_ps + best_remaining_score*i >= g:
            mincount = min(mincount, i + sum(comb))
            break

print(mincount)

Submission status: Wrong Answer

Solution code:
d, g = map(int,input().split())
plist = [list(map(int,input().split())) for i in range(d)]

basiclist = []

problem = []

for i in range(len(plist)):
    tmplist = [plist[i][0], (plist[i][0])*(i+1)*100+plist[i][1]]
    problem.append(plist[i][0])
    basiclist.append(tmplist)

# print(basiclist)

import itertools

combs = []

for i in range(1, len(problem)+1):
    els = [list(x) for x in itertools.combinations(problem, i)]
    combs.extend(els)

# print(combs)

mincount = 2**10+1


for i in range (d):
    for j in range (1, basiclist[i][0]):
        if j*(i+1)*100 >= g:
            mincount = min(mincount, j)


for comb in combs:
    remaininglist=[]
    for basic in basiclist:
        if basic[0] not in comb:
            remaininglist.append(basic[0])
    best_remaining_score = len(remaininglist)*100
    total_ps = 0
    for com in comb:
        tmp = 0
        for basic in basiclist:
            if com == basic[0]:
                if basic[1] > tmp:
                    tmp = basic[1]
        total_ps += tmp
    # print(total_ps)
    if len(remaininglist) == 0:
        mincount = min(mincount, sum(comb))
        continue
    for i in range(remaininglist[-1]):
        if total_ps + best_remaining_score*i >= g:
            mincount = min(mincount, i + sum(comb))
            break

print(mincount)

Submission status: Wrong Answer

Solution code:
d, g = map(int,input().split())
plist = [list(map(int,input().split())) for i in range(d)]

basiclist = []

problem = []

for i in range(len(plist)):
    tmplist = [plist[i][0], (plist[i][0])*(i+1)*100+plist[i][1]]
    problem.append(plist[i][0])
    basiclist.append(tmplist)

# print(basiclist)

import itertools

combs = []

for i in range(1, len(problem)+1):
    els = [list(x) for x in itertools.combinations(problem, i)]
    combs.extend(els)

# print(combs)

mincount = 2**10+1

for k in range (1, basiclist[-1][0]):
    if k*len(basiclist)*100 >= g:
        print(k)
        exit(0)

for comb in combs:
    remaininglist=[]
    for basic in basiclist:
        if basic[0] not in comb:
            remaininglist.append(basic[0])
    best_remaining_score = len(remaininglist)*100
    total_ps = 0
    for com in comb:
        tmp = 0
        for basic in basiclist:
            if com == basic[0]:
                if basic[1] > tmp:
                    tmp = basic[1]
        total_ps += tmp
    # print(total_ps)
    if len(remaininglist) == 0:
        mincount = min(mincount, sum(comb))
        continue
    for i in range(remaininglist[-1]):
        if total_ps + best_remaining_score*i >= g:
            mincount = min(mincount, i + sum(comb))
            break

print(mincount)

Submission status: Wrong Answer

Solution code:
d, g = map(int,input().split())
plist = [list(map(int,input().split())) for i in range(d)]

basiclist = []

problem = []

for i in range(len(plist)):
    tmplist = [plist[i][0], (plist[i][0])*(i+1)*100+plist[i][1]]
    problem.append(plist[i][0])
    basiclist.append(tmplist)

# print(basiclist)

import itertools

combs = []

for i in range(1, len(problem)+1):
    els = [list(x) for x in itertools.combinations(problem, i)]
    combs.extend(els)

# print(combs)

mincount = 9999999999999999

for k in range (1, basiclist[-1][0]):
    if k*len(basiclist) > g:
        print(k)
        exit(0)

for comb in combs:
    remaininglist=[]
    for basic in basiclist:
        if basic[0] not in comb:
            remaininglist.append(basic[0])
    best_remaining_score = len(remaininglist)*100
    total_ps = 0
    for com in comb:
        tmp = 0
        for basic in basiclist:
            if com == basic[0]:
                if basic[1] > tmp:
                    tmp = basic[1]
        total_ps += tmp
    # print(total_ps)
    if len(remaininglist) == 0:
        mincount = min(mincount, sum(comb))
        continue
    for i in range(remaininglist[-1]):
        if total_ps + best_remaining_score*i >= g:
            mincount = min(mincount, i + sum(comb))
            break

print(mincount)

Submission status: Wrong Answer

Solution code:
N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        if(count < num_min):
            num_min = count
            #print(count)
            break
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                if(G_new - 100*(N[0]-j)*pi[N[0]-1-j] <= 0):
                    count += -(-G_new//(100*(N[0]-j)))
                    if(count < num_min):
                        num_min = count
                break

    
print(num_min)

Submission status: Wrong Answer

Solution code:
N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        #print(i, flag)
        if(count < num_min):
            #print(count)
            num_min = count
            #print(count)
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                #print(i, flag, N[0]-1-j, G_new, pi[N[0]-1-j], count, -(-G_new//(100*(N[0]-j)))   )
                if(G_new - 100*(N[0]-j)*pi[N[0]-1-j] < 0):
                    count += G_new//(100*(N[0]-j))
                    if(count < num_min):
                       # print(count)
                        num_min = count
                break

    
print(num_min)

Submission status: Wrong Answer

Solution code:
N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        if(count < num_min):
            num_min = count
            #print(count)
            break
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                if(G_new - 100*(N[0]-j)*pi[N[0]-1-j] <= 0):
                    count += -(-G_new//(100*(N[0]-j)))
                    if(count < num_min):
                        num_min = count
                        break

    
print(num_min)

Submission status: Wrong Answer

Solution code:
N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])+1):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        if(count < num_min):
            num_min = count
            #print(count)
            break
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                if(pi[N[0]-1-j]>= -(-G_new//(100*(N[0]-j)))):
                    count += -(-G_new//(100*(N[0]-j)))
                    if(count < num_min):
                        num_min = count
                        break

    
print(num_min)

Submission status: Wrong Answer

Solution code:
N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])+1):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        if(count < num_min):
            num_min = count
            #print(count)
            break
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                if(G_new - 100*(N[0]-j)*pi[N[0]-1-j] < 0):
                    count += -(-G_new//(100*(N[0]-j)))
                    if(count < num_min):
                        num_min = count
                        #print(count)
                        break
                else:
                    G_new -= 100*(N[0]-j)*pi[N[0]-1-j]
                    count += pi[N[0]-1-j]                    
    
print(num_min)

Submission status: Wrong Answer

Solution code:
N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])+1):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        if(count < num_min):
            num_min = count
            #print(count)
            break
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                if(G_new - 100*(N[0]-j)*pi[N[0]-1-j] < 0):
                    count += -(-G_new//(100*(N[0]-j)))
                    if(count < num_min):
                        num_min = count
                        #print(count)
                        break
                else:
                    G_new - 100*(N[0]-j)*pi[N[0]-1-j]
                    count += pi[N[0]-1-j]                    
    
print(num_min)

Submission status: Wrong Answer

Solution code:
D, G = [int(i) for i in input().split()]
pc = {i: list(map(int, input().split())) for i in range(D)}

ans = float("inf")
# 各難易度ごとに、全部解くor解かないで場合わけ
for bit in range(1 << D):
    score = 0
    count = 0
    rest = set(pc.keys())
    for i in range(D):
        if (bit >> i) & 1:
            n_problem, complete_score = pc[i]
            score += n_problem * (i + 1) * 100 + complete_score
            count += n_problem
            rest.discard(i)
    lack = G - score
    if lack <= 0:
        ans = min(ans, count)
        continue
    use = max(rest)
    n_problem = pc[use][0]
    extra_count = lack // ((use+1) * 100)
    if extra_count >= n_problem:
        continue
    else:
        count += extra_count
    ans = min(ans, count)
print(ans)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
p=[]
C=[]
for _ in range(d):
    i,j = map(int,input().split())
    p.append(i)
    C.append(j)
ans=10**3
bit =[]
for i in range(2 ** d):
    l=[]
    for j in range(d):  
        if ((i >> j) & 1):
            l.append(j)
    bit.append(l)
for l in bit:
    # lは全部解いた点数
    rem = g
    c=0
    for i in range(d)[::-1]:
        if i in l :
            rem -= (i+1)*100*p[i]
            rem -= C[i]
            c += p[i]
            if rem <=0:
                break
        else:
            minus = (i+1)*100*(p[i]-1)
            if rem > minus:
                rem -= minus
                c+=p[i]-1
            else:
                c_temp = -(-rem//((i+1)*100))
                c += c_temp
                rem -= (i+1)*100*c_temp
                break
    if rem <= 0:
        ans=min(c,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
G = G // 100
sumn = 0
ns = [0] * (D + 1)
cs = [0] * (D + 1)
cache = [{} for _ in range(D + 1)]
for i in range(1, D + 1):
    n, c = map(int, input().split())
    ns[i] = n
    cs[i] = c // 100
    sumn += n

minn = [0] * (D + 1)
for i in range(1, D + 1):
    minn[i] = min(ns[1:i+1])

def f(i, rn):
    if i == 1:
        if ns[1] < rn:
            return -1
        p = rn
        if ns[0] == rn:
            p += cs[1]
        return p
    if rn < minn[i]:
        p = 0
        for j in range(i, 0, -1):
            n = min((ns[j], rn))
            p += i * n
            if n == rn:
                break
            rn -= n
        return p
    maxp = 0
    for n in range(min((ns[i], rn)) + 1):
        p = i * n
        if n == ns[i]:
            p += cs[i]
        nn = rn - n
        cch = cache[i - 1]
        np = cch.get(nn)
        if not np:
            np = f(i - 1, nn)
            cch[nn] = np
        if np >= 0:
            p += np
            if maxp < p:
                maxp = p
    return maxp

mn = 1
mx = sumn
while mn < mx:
    x = mn + ((mx - mn) // 2)
    if G <= f(D, x):
        mx = x
    else:
        mn = x + 1
print(mn)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(20000)

def dfs(i, num, totalValue):
	if i <= 0:
		return sys.maxsize
  
	if num > NUMS[i-1][0]:
		return dfs(i - 1, 1, totalValue)

	value = NUMS[i-1][2] *100 + (NUMS[i-1][1] if num == NUMS[i-1][0] else 0)
	if totalValue + value < G:
		return 1 + dfs(i, num + 1, totalValue + value)
	if totalValue + value >= G:
		return 1

def expectValue(num, i, bonus):
  return (num * i * 100.0 + bonus) / num
      
D, G = map(int, input().split())
if (D == 0 or G == 0):
	print(0)
	sys.exit()

NUMS = [list(map(int, input().split())) for _ in range(D)]
l = [((num, bonus, i + 1), expectValue(num, i + 1, bonus)) for i, (num, bonus) in enumerate(NUMS)]
NUMS = [x[0] for x in sorted(l, key=lambda x: x[1])]
#print([dfs(x, 1, 0) for x in reversed(range(1, D+1))])
print(min([dfs(x, 1, 0) for x in reversed(range(1, D+1))]))

Submission status: Wrong Answer

Solution code:
length, goal = map(int, input().split(" "))
nums = []
sumall = []
for i in range(length):
    a, b = map(int, input().split(" "))
    nums.append(a)
    sumall.append(a * (i + 1) * 100 + b)
answer = float("inf")
for bit in range(2 ** length):
    temp = []
    for i in range(length - 1, -1, -1):
        if bit & (1 << i):
            temp.append(i)
    temp_length = len(temp)
    for tempbit in range(2 ** temp_length):
        temp_sum = 0
        choosed = 0
        for i in range(temp_length):
            if tempbit & (1 << i):
                temp_sum += sumall[temp[i]]
                choosed += nums[temp[i]]
                if temp_sum >= goal:
                    # print(i, bin(bit), bin(tempbit), temp_sum, choosed, answer)
                    answer = min(answer, choosed)
                    break
            else:
                if temp_sum + (nums[temp[i]] - 1) * (temp[i] + 1) * 100 >= goal:
                    # print(i, bin(bit), bin(tempbit), temp_sum, choosed, answer)
                    answer = min(answer, choosed + ((goal - temp_sum) // (100 * (temp[i] + 1))) )
                    break
                temp_sum += (nums[temp[i]] - 1) * (temp[i] + 1) * 100
                choosed += nums[temp[i]] - 1
        # print(bin(bit), bin(tempbit), temp_sum, choosed, answer)
    # print(answer, bin(bit))
print(answer)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(20000)

def dfs(i, num, totalValue):
	if i <= 0:
		return 10000000000
  
	if num > NUMS[i-1][0]:
		return dfs(i - 1, 1, totalValue)

	value = NUMS[i-1][2] *100 + (NUMS[i-1][1] if num == NUMS[i-1][0] else 0)
	if totalValue + value < G:
		return 1 + dfs(i, num + 1, totalValue + value)
	if totalValue + value >= G:
		return 1

def expectation(num, i, bonus):
  return (num * i * 100 + bonus) / num
      
D, G = map(int, input().split())
if (D == 0 or G == 0):
	print(0)
	sys.exit()

NUMS = [list(map(int, input().split())) for _ in range(D)]
l = [((num, bonus, i + 1), expectation(num, i + 1, bonus)) for i, (num, bonus) in enumerate(NUMS)]
NUMS = [x[0] for x in sorted(l, key=lambda x: x[1])]
#print([dfs(x, 1, 0) for x in reversed(range(1, D+1))])
print(min([dfs(x, 1, 0) for x in reversed(range(1, D+1))]))

Submission status: Wrong Answer

Solution code:
import sys

def dfs(i, num, totalValue):
	if i -1 <= 0:
		return 10000000000
  
	if num > NUMS[i-1][0]:
		return dfs(i - 1, 1, totalValue)

	value = NUMS[i-1][2] *100 + (NUMS[i-1][1] if num == NUMS[i-1][0] else 0)
	if totalValue + value < G:
		return 1 + dfs(i, num + 1, totalValue + value)
	if totalValue + value >= G:
		return 1

def expectation(num, i, bonus):
  return (num * i * 100 + bonus) / num
      
D, G = map(int, input().split())
if (D == 0 or G == 0):
	print(0)
	sys.exit()

NUMS = [list(map(int, input().split())) for _ in range(D)]
l = [((num, bonus, i + 1), expectation(num, i + 1, bonus)) for i, (num, bonus) in enumerate(NUMS)]
NUMS = [x[0] for x in sorted(l, key=lambda x: x[1])]
#print([dfs(x, 1, 0) for x in reversed(range(1, D+1))])
print(min([dfs(x, 1, 0) for x in reversed(range(1, D+1))]))

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
import math
D, G = map(int, input().split())
score = [0] * D
for j in range(D):
    score[j] = [0] * 4
    score[j][0], score[j][1] = map(int, input().split())
    score[j][3] = (j+1) * 100
    score[j][2] = ((j+1) * 100 * score[j][0] + score[j][1]) / score[j][0]
ans = 0
nowscore = 0
while (nowscore < G):
    score = sorted(score, key=itemgetter(3), reverse=True)
    kouho_goal = score[0][3]
    kouho_numofproblem = score[0][0]

    score = sorted(score, key=itemgetter(2), reverse=True)
    if kouho_goal * kouho_numofproblem >= G - nowscore:
        ans_kouho = math.ceil((G - nowscore) / kouho_goal)
        for i in range(len(score)):
            if score[i][3] * score[i][0] + score[i][1] >= G - nowscore:
                ans_kouho = min(ans_kouho, score[i][0])
        ans += ans_kouho
        break
    else:
        ans += score[0][0]
        nowscore += score[0][3] * score[0][0] + score[0][1]
        score.pop(0)
        # print(ans)

print(ans)
# print(score)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
import math
D, G = map(int, input().split())
score = [0] * D
for j in range(D):
    score[j] = [0] * 4
    score[j][0], score[j][1] = map(int, input().split())
    score[j][3] = (j+1) * 100
    score[j][2] = ((j+1) * 100 * score[j][0] + score[j][1]) / score[j][0]
ans = 0
nowscore = 0
while (nowscore < G):
    score = sorted(score, key=itemgetter(3), reverse=True)
    kouho_goal = score[0][3]
    kouho_numofproblem = score[0][0]

    score = sorted(score, key=itemgetter(2), reverse=True)
    if kouho_goal * kouho_numofproblem >= G - nowscore and score[0][3] * score[0][0] + score[0][1] >= G - nowscore:
        ans_kouho = min(math.ceil((G - nowscore) / kouho_goal), score[0][0])
        for i in range(1, len(score)):
            if score[i][3] * score[i][0] + score[i][1] >= G - nowscore:
                ans_kouho = min(ans_kouho, score[i][0])
        ans += ans_kouho
        break
    else:
        ans += score[0][0]
        nowscore += score[0][3] * score[0][0] + score[0][1]
        score.pop(0)
        # print(ans)

print(ans)
# print(score)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
import math
D, G = map(int, input().split())
score = [0] * D
for j in range(D):
    score[j] = [0] * 4
    score[j][0], score[j][1] = map(int, input().split())
    score[j][3] = (j+1) * 100
    score[j][2] = ((j+1) * 100 * score[j][0] + score[j][1]) / score[j][0]
ans = 0
nowscore = 0
while (nowscore < G):
    score = sorted(score, key=itemgetter(3), reverse=True)
    kouho_goal = score[0][3]
    kouho_numofproblem = score[0][0]

    score = sorted(score, key=itemgetter(2), reverse=True)
    if kouho_goal * kouho_numofproblem >= G - nowscore and score[0][3] * score[0][0] + score[0][1] >= G - nowscore:
        ans_kouho = min(math.ceil((G - nowscore) / kouho_goal), score[0][0])
        for i in range(1, len(score)):
            if score[i][3] * score[i][0] + score[i][1] >= G - nowscore:
                ans_kouho = min(ans_kouho, score[i][0])

        if nowscore < G:
            ans += ans_kouho
        break
    else:
        ans += score[0][0]
        nowscore += score[0][3] * score[0][0] + score[0][1]
        score.pop(0)
        # print(ans)

print(ans)
# print(score)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
import math
D, G = map(int, input().split())
score = [0] * D
for j in range(D):
    score[j] = [0] * 4
    score[j][0], score[j][1] = map(int, input().split())
    score[j][3] = (j+1) * 100
    score[j][2] = ((j+1) * 100 * score[j][0] + score[j][1]) / score[j][0]
ans = 0
nowscore = 0
while (nowscore < G):
    score = sorted(score, key=itemgetter(3), reverse=True)
    kouho_goal = score[0][3]
    kouho_numofproblem = score[0][0]

    score = sorted(score, key=itemgetter(2), reverse=True)
    if kouho_goal * kouho_numofproblem >= G - nowscore and score[0][3] * score[0][0] + score[0][1] >= G - nowscore:
        ans_kouho = min(math.ceil((G - nowscore) / kouho_goal), score[0][0])
        for i in range(1, len(score)):
            if score[i][3] * score[i][0] + score[i][1] >= G - nowscore:
                ans_kouho = min(ans_kouho, score[i][0])
            else:
                ans += ans_kouho
                nowscore += G
                break
        if nowscore < G:
            ans += ans_kouho
        break
    else:
        ans += score[0][0]
        nowscore += score[0][3] * score[0][0] + score[0][1]
        score.pop(0)
        # print(ans)

print(ans)
# print(score)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
import math
D, G = map(int, input().split())
score = [0] * D
for j in range(D):
    score[j] = [0] * 4
    score[j][0], score[j][1] = map(int, input().split())
    score[j][3] = (j+1) * 100
    score[j][2] = ((j+1) * 100 * score[j][0] + score[j][1]) / score[j][0]
ans = 0
nowscore = 0
while (nowscore < G):
    score = sorted(score, key=itemgetter(3), reverse=True)
    kouho_goal = score[0][3]
    kouho_numofproblem = score[0][0]

    score = sorted(score, key=itemgetter(2), reverse=True)
    if kouho_goal * kouho_numofproblem >= G - nowscore and score[0][3] * score[0][0] + score[0][1] >= G - nowscore:
        ans_kouho = min(math.ceil((G - nowscore) / kouho_goal), score[0][0])
        for i in range(1, len(score)):
            if score[i][3] * score[i][0] + score[i][1] >= G - nowscore:
                ans_kouho = min(ans_kouho, score[i][0])
            else:
                ans += ans_kouho
                nowscore += 10**9
                break
        if nowscore < G:
            ans += ans_kouho
        break
    else:
        ans += score[0][0]
        nowscore += score[0][3] * score[0][0] + score[0][1]
        score.pop(0)
        # print(ans)

print(ans)
# print(score)

Submission status: Wrong Answer

Solution code:
dp = [[0 for n in range(1001)] for m in range(11)]
length, goal = map(int, input().split(" "))
problems = []
for l in range(length):
    a, b = map(int, input().split(" "))
    problems.append([a, b])

for i in range(length):
    max_problems = problems[i][0]
            
    for k in range(1000):
        if dp[i][k]:
            for l in range(max_problems):
                dp[i + 1][k + 1 + l] = max(dp[i + 1][k + 1 + l], dp[i][k] + (i + 1) * 100 * (l + 1) + (problems[i][1] * int(l + 1 == max_problems)) )
    for l in range(max_problems):
        dp[i + 1][1 + l] = max(dp[i + 1][1 + l], (i + 1) * 100 * (l + 1) + (problems[i][1] * int(l + 1 == max_problems)) )
        # print(dp[i + 1][1])
answer = float("inf")
for i in range(11):
    for j in range(1001):
        if dp[i][j] >= goal:
            answer = min(answer, j)
print(answer)

Submission status: Wrong Answer

Solution code:
def dfs(problems: "scores", now_depth: int, g: int) -> int:
  if now_depth == 0:
    return 10 ** 9 # 十分に大きい値
  
  # ある得点帯iにおいて,gを達成するのに必要な問題数を考える
  # g // (100 * idx) は, コンプリートボーナスを考えない場合の問題数
  # これを min() でコンプリートボーナス達成に必要な問題数と比べる.
  solve_count = min(g // (100 * now_depth), problems[now_depth][0]) # // は余り切り捨て
  score = 100 * now_depth * solve_count

  # コンプリートボーナス(に必要な問題数)を選んだときは更に加算
  if solve_count == problems[now_depth][0]:
    score += problems[now_depth][1]
  
  if score < g:
    solve_count += dfs(problems, now_depth - 1, g)
  
  return min(solve_count, dfs(problems, now_depth - 1, g))

depth, g = [ int(x) for x in input().split() ]
# [0] は問題番号と入力の帳尻を合わせる為につけているもの.使用しない.
problems = [0] + [ [ int (x) for x in input().split() ] for _ in range(depth) ]
print(dfs(problems, depth, g))