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: Time Limit Exceeded

Solution code:
D,G = map(int, input().split())
 
num_of_problems, complete_bonus = {},{}
 
for i in range(1, D+1):
    num_of_problems[i], complete_bonus[i] = map(int, input().split())
 
import itertools
 
min_num_of_solve = sum(num_of_problems.values())
 
for solve_order in itertools.permutations(num_of_problems.keys()): #解く順番を変えて総当り
    score_sum = 0
    num_of_solve = 0
 
    for j in range(len(solve_order)):
        for k in range(num_of_problems[solve_order[j]]):
            score_sum += solve_order[j]*100
            num_of_solve += 1
            if score_sum >= G:
                break
        
        score_sum += complete_bonus[solve_order[j]]
        if score_sum >= G:
            break
    min_num_of_solve = min(min_num_of_solve, num_of_solve)
    
print(min_num_of_solve)

Submission status: Time Limit Exceeded

Solution code:
D,G = map(int, input().split())

num_of_problems, complete_bonus = {},{}

for i in range(1, D+1):
    num_of_problems[i], complete_bonus[i] = map(int, input().split())

import itertools

min_num_of_solve = sum(num_of_problems.values())

for solve_order in itertools.permutations(num_of_problems.keys()): #解く順番を変えて総当り
    score_sum = 0
    num_of_solve = 0

    for j in range(len(solve_order)):
        for k in range(num_of_problems[solve_order[j]]):
            score_sum += solve_order[j]*100
            num_of_solve += 1
            if score_sum >= G:
                break
        
        score_sum += complete_bonus[solve_order[j]]
        if score_sum >= G:
            break
    min_num_of_solve = min(min_num_of_solve, num_of_solve)
    
print(min_num_of_solve)

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(10*20)

D, G = map(int, input().split())
pc=[]
for _ in range(D):
    pc.append(tuple(map(int, input().split())))
#print(pc)

m=1000
def solve(diff, score, question_num):
    global m
    for num in range(pc[diff][0]+1):
        temp=0
        temp+=num*(diff+1)*100
        if num==pc[diff][0]:
           temp+=pc[diff][1]

        #print(diff, num, temp)
        if diff+1 <= D-1:
            score+=temp
            question_num+=num
            solve(diff+1, score, question_num)
            score-=temp
            question_num-=num
        else:
            score+=temp
            question_num+=num
            #print('score',score, question_num)
            if score >=G and question_num < m:
                m = question_num
            question_num-=num
            score-=temp
    return None
solve(0, 0, 0)

print(m)

Submission status: Time Limit Exceeded

Solution code:
D,G=map(int,input().split())
p=[]
c=[]
for i in range(D):
  p_i,c_i=map(int,input().split())
  p.append(p_i)
  c.append(c_i)
min=sum(p)
for i in range(2**sum(p)):
  a=0
  ac=0
  total=0
  for j in range(D):
    cnt=0
    for k in range(a,a+p[j]):
      if ((i>>k)&1):
        cnt+=1
    if cnt==p[j]:
      total+=100*(j+1)*p[j]+c[j]
    else:
      total+=100*(j+1)*cnt
    a+=p[j]
    ac+=cnt
  if total>=G and ac<=min:
    min=ac
print(min)

Submission status: Time Limit Exceeded

Solution code:
def cont(ob,j):
    if (ob <= 0):
            return 0
    for i in range(len(j)):
        ob -= j[i]
        if (ob <= 0):
            return i+1
    return 9999

d,ob = map(int,input().split())
lst = []
point = []
kai = [[0 for i in range(ob//100)] for j in range(d)]

for i in range(d):
    lst =[]
    a = list(map(int,input().split()))
    for j in range(a[0]):
        lst.append((i+1)*100)
    lst[j] += a[1]
    point.append(lst)


for i in range(len(kai)):
    for j in range(len(kai[0])):
        if i == 0:
            kai[i][j] = cont((j+1)*100,point[i])
        else:
            if(sum(point[i])<(j+1)*100):
                a = kai[i-1][j]
                b = len(point[i]) + kai[i-1][j-sum(point[i])//100 ]
                if a>b:
                    kai[i][j] = b
                else:
                    kai[i][j] = a
            else:
                a = kai[i-1][j]
                b = cont((j+1)*100,point[i])
                if a>b:
                    kai[i][j] = b
                else:
                    kai[i][j] = a
        #print(kai)

#print(point)
print(kai[len(kai)-1][len(kai[0])-1])

Submission status: Time Limit Exceeded

Solution code:
D,G = map(int,input().split())
G /= 100
G=int(G)
vec = list(list(map(int,input().split())) for i in range(D))
for i in range(D):
    vec[i][1] /= 100
    vec[i][1] = int(vec[i][1])

dp = [[10**7 for i in range(G+1)] for j in range(D+1)]
dp[0][0] = 0
for i in range(D):
    for j in range(G+1):
        for k in range(vec[i][0]+1):
            posit = min(j+(i+1)*k,G)
            if(k == vec[i][0]):
                posit += vec[i][1]
                posit = min(G,posit)
            dp[i+1][posit] = min(dp[i][posit], dp[i][j] + k,dp[i + 1][posit])
        for k in reversed(range(G)):
            if(dp[i+1][k] == 10**7):
                dp[i+1][k] = dp[i+1][k]
print(dp[D][G])

Submission status: Time Limit Exceeded

Solution code:
D,G = map(int,input().split())
G /= 100
G=int(G)
vec = list(list(map(int,input().split())) for i in range(D))
for i in range(D):
    vec[i][1] /= 100
    vec[i][1] = int(vec[i][1])
    
dp = [[10**7 for i in range(G+1)] for j in range(D+1)]
dp[0][0] = 0
for i in range(D):
    for j in range(G+1):
        for k in range(vec[i][0]+1):
            posit = min(j+(i+1)*k,G)
            if(k == vec[i][0]):
                posit += vec[i][1]
                posit = min(G,posit)
            dp[i+1][posit] = min(dp[i][posit], dp[i][j] + k,dp[i + 1][posit])
        for k in reversed(range(G)):
            if(dp[i+1][k] == 10**7):
                dp[i+1][k] = dp[i+1][k]
print(dp[D][G])

Submission status: Time Limit Exceeded

Solution code:
import itertools

d,g=map(int,input().split())
p=[0 for _ in range(d)]
c=[0 for _ in range(d)]
l=[[] for _ in range(d)]

for i in range(d):#値を取得！
	p[i],c[i]=map(int,input().split())

for i in range(d):#リストつくる！
	for j in range(p[i]+1):
		l[i].append((i+1)*100*j)
	l[i][p[i]] += c[i]

r = list(itertools.product(*l))
m = len(r)
for i in r:
	if sum(i)>=g:
		count = 0
		for j in range(d):
			count += l[j].index(i[j])
		if count <= m:
			m = count
print(m)

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(10*20)

D, G = map(int, input().split())
pc=[]
for _ in range(D):
    pc.append(tuple(map(int, input().split())))
#print(pc)

candicate=[]
def solve(diff, score, question_num):
    for num in range(pc[diff][0]+1):
        temp=0
        temp+=num*(diff+1)*100
        if num==pc[diff][0]:
           temp+=pc[diff][1]

        #print(diff, num, temp)
        if diff+1 <= D-1:
            score+=temp
            question_num+=num
            solve(diff+1, score, question_num)
            score-=temp
            question_num-=num
        else:
            score+=temp
            question_num+=num
            #print('score',score, question_num)
            if score >=G:
                candicate.append(question_num)
            question_num-=num
            score-=temp
    return None
solve(0, 0, 0)

print(min(candicate))

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

def flag(point,P,now):
    if point+100*(now+1)*(P-1) >= g: return 1
    elif point+100*(now+1)*P + C[now] >= g: return 2
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif now == -1:
        for i in remain:
            score(point, n, i, remain)
    elif point >= g: m = n
    elif flag(point,P[now],now) == 1:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    elif flag(point,P[now],now) == 2:
        n += P[now]
        if m > n: m = n
    else:
        if m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
import sys
sys.setrecursionlimit(10 ** 6)
def input():
    return sys.stdin.readline()[:-1] 

d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in range(d):
                score(point, n, i, done)
        elif m <= n+P[now]: return
        else:
            done = done[:]
            done.append(now)
            nxtp = point+P[now]*100*(now+1) + C[now]
            for i in range(d):
                if not i in done:
                    score(nxtp, n + P[now], i, done)

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
import itertools, math
d,g = list(map(int,input().split()))
pc = [list(map(int,input().split())) for _ in range(d)]
g /= 100

pat = list(itertools.permutations(range(d)))
ans = sum([pc[x][0] for x in range(d)])

def dfs(k, point, cnt, pat):
  global ans
  i = pat[k]
  
  cnt += min(pc[i][0], math.ceil((g-point)/(i+1)))
  point += min(pc[i][0], math.ceil((g-point)/(i+1))) * (i+1)
  point += pc[i][1]//100
  #print(k,i,point,cnt)
  if point >= g:  
    ans  = min(ans, cnt)
    return
  else:
    if k < d-1:
      dfs(k+1, point, cnt, pat)
      

for p in pat:
  dfs(0, 0, 0, list(p))

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,k = list(map(int,input().split()))
l = []
for i in range(n):
  array = list(map(int,input().split()))
  l_append=l.append
  l_append(array)

chk = []
chk_append=chk.append
def f(a,b,c):
  if a==n:
    if b>=k:
      chk_append(c)
      return
  else:
    return [f(a+1,b+100*(a+1)*i,c+i) for i in range(l[a][0])] and f(a+1,b+100*(a+1)*(l[a][0])+l[a][1],c+l[a][0])
  
f(0,0,0)
print(min(chk))

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(2000)

D, goal = map(int, input().split())
q_num, bonus = [], []
for i in range(1,D+1):
  q, b = map(int, input().split())
  q_num.append(q)
  bonus.append(b)
ans = 100000

def rec(comb, next_n, current_score):
  if next_n == D + 1:
    global ans
    if current_score >= goal:
      ans = min(ans, sum(comb))
  else:
    for i in range(q_num[next_n-1]):
      rec(comb + [i], next_n+1, current_score + i * next_n * 100)
    rec(comb + [q_num[next_n-1]], next_n+1, current_score + q_num[next_n-1] * next_n * 100 + bonus[next_n-1])
rec([], 1, 0)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n,k = list(map(int,input().split()))
l = []
for i in range(n):
  array = list(map(int,input().split()))
  line = [int(j)*100*(i+1) for j in range(array[0])]
  line.append(array[0]*100*(i+1)+array[1])
  l.append(line)

chk = []
def f(a,b,c):
  if a==n:
    if b>=k:
      chk.append(c)
      return
  else:
    return [f(a+1,b+l[a][i],c+i) for i in range(len(l[a]))]
f(0,0,0)

print(min(chk))

Submission status: Time Limit Exceeded

Solution code:
n,k = [int(i) for i in input().split()]
pg = []
for i in range(n):
  array = list(map(int,input().split()))
  pg.append(array)
l = []

for i in range(n):
  line = [int(j)*100*(i+1) for j in range(pg[i][0])]
  line.append(pg[i][0]*100*(i+1)+pg[i][1])
  l.append(line)

chk = []

def f(a,b,c):
  if a==n:
    if b>=k:
      chk.append(c)
      return
  else:
    return [f(a+1,b+l[a][i],c+i) for i in range(len(l[a]))]
f(0,0,0)

print(min(chk))

Submission status: Time Limit Exceeded

Solution code:
n,k = [int(i) for i in input().split()]
pg = []
for i in range(n):
  array = list(map(int,input().split()))
  pg.append(array)
l = []

for i in range(n):
  line = [int(j)*100*(i+1) for j in range(pg[i][0])]
  line.append(pg[i][0]*100*(i+1)+pg[i][1])
  l.append(line)

chk = []
chk_append = chk.append
def f(a,b,c):
  if a == n:
    chk_append([b,c])
  else:
    return [f(a+1,b+l[a][i],c+i) for i in range(len(l[a]))]
f(0,0,0)

ans = []
ans_append = ans.append
for i in chk:
  if i[0] >= k:
    ans_append(i[1])
print(min(ans))

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

n,k = [int(i) for i in input().split()]
pg = []
for i in range(n):
  array = list(map(int,input().split()))
  pg.append(array)
l = []
 
for i in range(n):
  line = [int(j)*100*(i+1) for j in range(pg[i][0])]
  line.append(pg[i][0]*100*(i+1)+pg[i][1])
  l.append(line)

chk = []
chk_append = chk.append
def f(a,b,c):
  if a == n:
    chk_append([b,c])
  else:
    return [f(a+1,b+l[a][i],c+i) for i in range(len(l[a]))]
f(0,0,0)
 
ans = []
ans_append = ans.append
for i in chk:
  if i[0] >= k:
    ans_append(i[1])
print(min(ans))

Submission status: Time Limit Exceeded

Solution code:
n,k = [int(i) for i in input().split()]
pg = []
for i in range(n):
  array = list(map(int,input().split()))
  pg.append(array)
l = []

for i in range(n):
  line = [int(j)*100*(i+1) for j in range(pg[i][0])]
  line.append(pg[i][0]*100*(i+1)+pg[i][1])
  l.append(line)

a = 0
chk =[]
def f(a,b,c):
  if a == n:
    chk.append([b,c])
  else:
    return [f(a+1,b+l[a][i],c+i) for i in range(len(l[a]))]
f(0,0,0)

ans = []
for i in chk:
  if i[0] >= k:
    ans.append(i[1])
print(min(ans))

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in range(d):
                score(point, n, i, done)
        elif m <= n+P[now]: return
        else:
            done = done[:]
            done.append(now)
            nxtp = point+P[now]*100*(now+1) + C[now]
            for i in range(d):
                if not i in done:
                    score(nxtp, n + P[now], i, done)

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in range(d):
                score(point, n, i, done)
        elif m <= n+P[now]: return
        else:
            done = done[:]
            done.append(now)
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done)

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in range(d):
                done = done[:]
                score(point, n, i, done)
        elif m <= n+P[now]: return
        else:
            done = done[:]
            done.append(now)
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done)

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
import copy
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done = copy.copy(done)
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, i, done)
        elif m <= n+P[now]: return
        else:
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done)

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, i, done[:])
        elif m <= n+P[now]: return
        else:
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done[:])

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        temp = math.ceil((g-point)/(100*(now+1)))
        n += temp
        if m > n: m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                nxtdone = done[:]
                score(point, n, i, nxtdone)
        elif m <= n+P[now]: return
        else:
            for i in range(d):
                if not i in done:
                    nxtp = point+P[now]*100*(now+1) + C[now]
                    nxtn = n + P[now]
                    nxtdone = done[:]
                    score(nxtp, nxtn, i, nxtdone)

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, d-1-i, done[:])
        elif m <= n+P[now]: return
        else:
            for i in range(d):
                if not d-1-i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], d-1-i, done[:])

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, i, done[:])
        elif m <= n+P[now]: return
        else:
            for i in range(d):
                if not d-1-i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], d-1-i, done[:])

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, i, done[:])
        elif m <= n+P[now]: return
        else:
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done[:])

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)
 
m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m < n: return
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, i, done[:])
        else:
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done[:])

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)
 
m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, i, done[:])
        else:
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done[:])

score()
print(m)

Submission status: Time Limit Exceeded

Solution code:
import copy
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)
 
m = 10**9
def score(point = 0, n = 0, now=0, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, i, copy.copy(done))
        else:
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, copy.copy(done))

done = []
score(0,0,-1,done)
print(m)

Submission status: Time Limit Exceeded

Solution code:
import copy
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)
 
m = 10**9
def score(point = 0, n = 0, now=0, done=set()):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        done.add(now)
        for i in range(d):
            if not i in done:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, copy.copy(done))
 
for i in range(d):
    done = set()
    score(0,0,i,done)
print(m)

Submission status: Time Limit Exceeded

Solution code:
import copy
import math
 
d,g = map(int,input().split())
P = []
C = []
for i in range(d):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
 
m = 10**9
def score(point = 0, n = 0, now=0, done=set()):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        done.add(now)
        for i in range(d):
            if not i in done:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, copy.copy(done))
 
for i in range(d):
    done = set()
    score(0,0,i,done)
print(m)

Submission status: Time Limit Exceeded

Solution code:
import copy
import math
 
d,g = map(int,input().split())
P = []
C = []
for i in range(d):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
 
m = 10**9
def score(point = 0, n = 0, now=0, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        done.append(now)
        for i in range(d):
            if not i in done:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, copy.copy(done))
 
for i in range(d):
    done = []
    score(0,0,i,done)
print(m)

Submission status: Time Limit Exceeded

Solution code:
import _pickle as cPickle
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)
 
m = 10**9
def score(point = 0, n = 0, now=0, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        done.append(now)
        for i in range(d):
            if not i in done:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, cPickle.loads(cPickle.dumps(done, -1)))
 
for i in range(d):
    done = []
    score(0,0,i,done)
print(m)

Submission status: Time Limit Exceeded

Solution code:
import copy
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)
 
m = 10**9
def score(point = 0, n = 0, now=0, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        done.append(now)
        for i in range(d):
            if not i in done:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done.copy())
 
for i in range(d):
    done = []
    score(0,0,i,done)
print(m)