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:
D,G=list(map(int, input().strip().split()))
pc=[list(map(int, input().strip().split())) for i in range(D)]
pp=[]
for i in range(D):
    p,c=pc[i]
    total=(p*(i+1)*100+c)
    pp.append([(i+1)*100,i+1,False])
    pp.append([total/p,i+1,True])
    
pp=sorted(pp,key=lambda x:x[0],reverse=True)
def can_clear(num,points):
    points2=list(points)
    score=0
    used=[False]*(D+1)
    for i,q in enumerate(points2):
        ave,N,iscomp=q
        if used[N]:continue
        if iscomp:
            p,c=pc[N-1]
            if p>num:
                continue
            num-=p
            score+=p*N*100+c
            used[N]=True
        else:
            p,c=pc[N-1]
            use_num=min(p,num)
            num-=use_num
            score+=use_num*100*N
            used[N]=True
        if score>=G:
            return True
        elif num<=0:
            return False
    return False
num=1
while True:
    if can_clear(num,pp):
        print(num)
        break
    num+=1

Submission status: Wrong Answer

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

p_list = []
c_list = []
for i in range(D):
    p, c = map(int, input().split())
    p_list.append(p)
    c_list.append(c)

fi = 0
co = 0
result1=0
for i in range(D-1, -1, -1):
    if fi >= G:
        break
    p = p_list[i]
    while p > 0:
        p -= 1
        fi += 100 * (i+1)
        print(fi)
        result1 +=1
        if p==0:
            fi += c_list[i]
        if fi >= G:
            break

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
pc=[list(map(int,input().split()))for _ in [0]*d]
s=0
r=0
for i in reversed(range(d)):
    t=(g-s)//((i+1)*100)
    if t<pc[i][0]:print(r+t);exit()
    else:s+=(i+1)*100*pc[i][0]+pc[i][1];r+=pc[i][0]

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
pc = [[i + 1] + [int(x) for x in input().split()] for i in range(D)]

import math
def calc_cp(pc, left):
    cp = []
    for x in pc:
        i, p, c = x
        base = i*p*100
        if base <= left:
            total = min(left, base + c)
            cpi = total / p
        else:
            total = left
            cpi = left / math.ceil(left / (i*100))
        cp.append((cpi, total, x))
    return cp

ans = 0
left = G
while left > 0:
    cp = sorted(calc_cp(pc, left), reverse=True)
    cpi, total, x = cp[0]
    i, p, c = x
    if left <= total:
        y = min(p, math.ceil(left/(i*100)))
        ans += y
        left -= total
    else:
        ans += p
        left -= total
    pc.remove(x)
print(ans)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
P = []
num_p = 0
for i in range(1,D+1):
    p,c = map(int,input().split())
    num_p += p
    for j in range(1,p+1):
        P += [(j,i*100*j+c*(j==p))]
dp = [0]*(num_p+1)
for k,pt in P:
    if k==1:
        t_dp = dp[:]
    for cur in range(1,num_p+1):
        if cur>=k:
            dp[cur] = max(dp[cur], t_dp[cur-k] + pt)
for i in range(num_p):
    if dp[i]>=G:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
pcs = [[int(s) for s in input().split()] for _ in range(D)]
 
def calc(pcs, D, G):
    if D == 0:
        return 100000000
    if G <= 0:
        return 0
 
    t = G // (D * 100)
    
    if t < pcs[D - 1][0]:
        if D == 1:
            return t
        else:
            return min(t, calc(pcs, D - 1, G))
    else:
        nG = G - (pcs[D - 1][0] * D * 100) - pcs[D - 1][1]
        b = pcs[D - 1][0] + calc(pcs, D - 1, nG)
        for n in range(pcs[D - 1][0] - 1, -1, -1):
            t = n + calc(pcs, D - 1, G - n * D * 100)
            if t >= b:
                break
            b = t
        return b
 
print(calc(pcs, D, G))

Submission status: Wrong Answer

Solution code:
def div_float(a, b):
    c = a/b
    if c*b == a: return c
    else: return c+1

D, G = [int(x) for x in raw_input().split()]
P = []
C = []
for _ in range(D):
    p, c = [int(x) for x in raw_input().split()]
    P.append(p)
    C.append(c)

min_q = sum(P)

for i in range(D-1, -1, -1):
    G_start = G
    tmp_q = 0
    j = i
    while G_start > 0 and j > -1:
        p, c = P[j], C[j]
        max_j = p*(j+1)*100 + c
        if max_j >= G_start:
            tmp_q += min(p, div_float(G_start, (j+1)*100))
            G_start = 0
        else:
            tmp_q += p
            G_start -= max_j
            j -= 1
    if G_start <= 0:
        min_q = min(min_q, tmp_q)
print min_q

Submission status: Wrong Answer

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

p_dummy = [pc_i[0] for pc_i in pc]
count = 0
score = 0
while score < g:
    points = []
    for i, pc_i in enumerate(pc, start=1):
        p_i, c_i = pc_i
        if p_i <= 0:
            continue
        num = 100*i
        if 100*i*(p_i) < (g - score):
            num += c_i / p_dummy[i-1]
        points.append((i, num))
    max_point = max(points, key=lambda x: x[1])
    pc[max_point[0]-1][0] -= 1
    score += max_point[1]
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
pcs = [[int(s) for s in input().split()] for _ in range(D)]
 
def calc(pcs, D, G):
    if D == 0:
        return 100000000
    if G <= 0:
        return 0
 
    t = G // (D * 100)
    
    if t < pcs[D - 1][0]:
        if D == 1:
            return t
        else:
            return min(t, calc(pcs, D - 1, G))
    else:
        nG = G - (pcs[D - 1][0] * D * 100) - pcs[D - 1][1]
        b = pcs[D - 1][0] + calc(pcs, D - 1, nG)
        for n in range(pcs[D - 1][0]):
            b = min(b, n + calc(pcs, D - 1, G - n * D * 100))
        return b
 
print(calc(pcs, D, G))

Submission status: Wrong Answer

Solution code:
def div_float(a, b):
    c = a/b
    if a*b == a: return c
    else: return c+1

D, G = [int(x) for x in raw_input().split()]
P = []
C = []
for _ in range(D):
    p, c = [int(x) for x in raw_input().split()]
    P.append(p)
    C.append(c)

min_q = sum(P)

for i in range(D-1, -1, -1):
    G_start = G
    tmp_q = 0
    j = i
    while G_start > 0 and j > -1:
        p, c = P[j], C[j]
        max_j = p*(j+1)*100 + c
        if max_j >= G_start:
            tmp_q += min(p, div_float(G_start, (j+1)*100))
            G_start = 0
        else:
            tmp_q += p
            G_start -= max_j
            j -= 1
    if G_start <= 0:
        min_q = min(min_q, tmp_q)
print min_q

Submission status: Wrong Answer

Solution code:
D,G=list(map(int, input().strip().split()))
pc=[list(map(int, input().strip().split())) for i in range(D)]
pp=[]
for i in range(D):
    p,c=pc[i]
    total=(p*(i+1)*100+c)
    pp.append([(i+1)*100,0,p,0,i+1])
    pp.append([total/p,p,p,total,i+1])
    
pp=sorted(pp,key=lambda x:x[0],reverse=True)

def can_clear(num,points):
    points2=list(points)
    score=0
    used=set()
    for i,q in enumerate(points2):
        ave,ct,mx,total,N=q
        if N in used:continue
        if ct>0:
            if ct<=num:
                num-=ct
                score+=total
                used.add(N)
        else:
            use=min(mx,num)
            num-=use
            score+=use*ave
            used.add(N)
        if score>=G:
            return True
        elif num<=0:
            return False
    return False
num=1
while True:
    if can_clear(num,pp):
        print(num)
        break
    num+=1

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
pcs = [[int(s) for s in input().split()] for _ in range(D)]
 
def calc(pcs, D, G):
    if D == 0:
        return 100000000
    if G <= 0:
        return 0
 
    t = G // (D * 100)
    
    if t < pcs[D - 1][0]:
        if D == 1:
            return t
        else:
            return min(t, calc(pcs, D - 1, G))
    else:
        nG = G - (pcs[D - 1][0] * D * 100) - pcs[D - 1][1]
        b = pcs[D - 1][0] + calc(pcs, D - 1, nG)
        for n in range(pcs[D - 1][0]):
            return min(b, n + calc(pcs, D - 1, G - n * D * 100))
 
print(calc(pcs, D, G))

Submission status: Wrong Answer

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

A = [0]*D
for i in range(D):
    total = ((i+1)*100*P[i]+C[i])
    A[i] = (total/P[i],total,i)
A.sort(reverse=True)

Ans1 = 0
B = []
flg = True
for a in A:
    avg,total,i = a
    if G > total and flg:
        G -= total
        Ans1 += P[i]
    else:
        flg = False
        B.append(a)

Ans2 = []
for b in B:
    avg,total,i = b
    ans = 0
    g = G
    for j in range(P[i]):
        g -= (i+1)*100
        ans += 1
        if g <= 0:
            break
    if g > 0:
        g -= C[i]
    if g <= 0:
        Ans2.append(ans)

print(Ans1+min(Ans2))

Submission status: Wrong Answer

Solution code:
import itertools
D,G=map(int,input().split())
p=[0 for i in range(D)]
c=[0 for i in range(D)]
for i in range(D):
    p[i],c[i]=map(int,input().split())
S=list(itertools.permutations(range(D),D))
ans=sum(p)
for seq in S:
    tmpp=0
    tmps=0
    for i in seq:
        if tmps+(p[i]*(i+1)*100+c[i])<G:
            tmps+=p[i]*(i+1)*100+c[i]
            tmpp+=p[i]
        else:
            k=(-G+tmps)//(-(i+1)*100)
            if k>p[i]:
                k=p[i]
            tmpp+=k
            tmps+=k*p[i]
            break
    if tmpp<ans:
        ans=tmpp
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
pcs = [[int(s) for s in input().split()] for _ in range(D)]
 
def calc(pcs, D, G):
    if D == 0:
        return 100000000
    if G <= 0:
        return 0
 
    t = G // (D * 100)
    
    if t < pcs[D - 1][0]:
        if D == 1:
            return t
        else:
            return min(t, calc(pcs, D - 1, G))
    else:
        nG = G - (pcs[D - 1][0] * D * 100) - pcs[D - 1][1]
        b = pcs[D - 1][0] + calc(pcs, D - 1, nG)
        return min(b, calc(pcs, D - 1, G))
 
print(calc(pcs, D, G))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from math import ceil

D, G = [int(t) for t in input().split()]
p = []
c = []
for i in range(D):
    p_, c_ = [int(t) for t in input().split()]
    p.append(p_)
    c.append(c_)

def minsolve(G, p, c, i):
    """100i点以下の問題だけでGを達成する最小問題数"""
    if i <= 0:
        return float('inf')
    n = min(ceil(G / (100 * i)), p[i-1])
    s = 100 * i * n
    if n == p[i-1]:
        s += c[i-1]
    if s >= G:
        return n
    else:
        return n + minsolve(G - s, p, c, i-1)

m = min(minsolve(G, p, c, i) for i in range(1, D+1))
print(m)

Submission status: Wrong Answer

Solution code:
from math import ceil

D, G = [int(x) for x in raw_input().split()]
P = []
C = []
for _ in range(D):
    p, c = [int(x) for x in raw_input().split()]
    P.append(p)
    C.append(c)

min_q = sum(P)

for i in range(D-1, -1, -1):
    G_start = G
    tmp_q = 0
    j = i
    while G_start > 0 and j > -1:
        p, c = P[j], C[j]
        max_j = p*(j+1)*100 + c
        if max_j >= G_start:
            tmp_q += min(p, int(ceil(G_start/((j+1.)*100))))
            G_start = 0
        else:
            tmp_q += p
            G_start -= max_j
            j -= 1
    if G_start <= 0:
        min_q = min(min_q, tmp_q)
print min_q

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
pcs = [[int(s) for s in input().split()] for _ in range(D)]

def calc(pcs, D, G):
    if G <= 0:
        return 0

    t = G // (D * 100)
    
    if t < pcs[D - 1][0]:
        if D == 1:
            return t
        else:
            return min(t, calc(pcs, D - 1, G))
    else:
        nG = G - (pcs[D - 1][0] * D * 100) - pcs[D - 1][1]
        return pcs[D - 1][0] + calc(pcs, D - 1, nG)

print(calc(pcs, D, G))

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
pc = [[i + 1] + [int(x) for x in input().split()] for i in range(D)]

def calc_cp(pc, left):
    cp = []
    for x in pc:
        i, p, c = x
        if i * p * 100 <= left:
            total = i*100 * p + c
        else:
            total = i*100 * p
        cp.append((total/p, total, x))
    return cp

import math
ans = 0
left = G
while left > 0:
    cp = sorted(calc_cp(pc, G), reverse=True)
    cpi, total, x = cp[0]
    i, p, c = x
    if total <= G:
        y = min(p, math.ceil(left/(i*100)))
        ans += y
        left -= total
    else:
        ans += p
        left -= total
    pc.remove(x)
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
pcs = [[int(s) for s in input().split()] for _ in range(D)]

def calc(pcs, D, G):
    if D == 0:
        return 10000000
    if G <= 0:
        return 0

    t = G // (D * 100)
    
    if t <= pcs[D - 1][0]:
        if D == 1:
            return t
        else:
            return min(t, calc(pcs, D - 1, G))
    else:
        nG = G - (pcs[D - 1][0] * D * 100) - pcs[D - 1][1]
        return pcs[D - 1][0] + calc(pcs, D - 1, nG)

print(calc(pcs, D, G))

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P, C = [], []
for i in range(D):
    pi, ci = map(int, input().split())
    P.append(pi)
    C.append(ci)


U = {100*(i+1): i for i in range(D)}

ans = float('inf')
for i in range(2**D):
    S = {100 * (i + 1): 0 for i in range(D)}
    A = []
    X_solve, X_score = 0, 0
    bit = bin(2**D + i)[3:]

    for j in range(D):
        if bit[j] == "1":
            X_solve += P[j]
            X_score = 100 * (j+1) * P[j] + C[j]
        else:
            A += [100*(j+1)] * P[j]

    if X_score >= G:
        ans = min(ans, X_solve)
        #print(bit, X_solve, X_score)
        continue

    A = A[::-1]
    for k in range(len(A)):
        X_score += A[k]
        S[A[k]] += 1

        if S[A[k]] == P[U[A[k]]]:
            X_score += C[U[A[k]]]

        if X_score >= G:
            ans = min(ans, X_solve + k + 1)
            #print(bit, X_solve + k + 1, X_score, A)
            break

print(ans)

Submission status: Wrong Answer

Solution code:
D, G = (int(i) for i in input().split())
G = G // 100
P= [0] * D
C= [0] * D

for i in range(D):
    P[i], C[i] = (int(i) for i in input().split())
    C[i] = C[i] // 100

INF = int(1e9)
mem = [[0] * G for _ in range(D+1)]
used = [[0] * G for _ in range(D+1)]
print (mem)

def dfs(idx, g):
    if g >= G:
        return 0
    if idx == D:
        return INF

    if(used[idx][g]):
        return mem[idx][g]
    used[idx][g] = 1
    
    p = P[idx]
    c = C[idx]
    res = INF
    for i in range(p+1):
        score = g + (idx + 1) * i
        if(i == p):
            score = score + c
        res = min(res, i + dfs(idx+1, score))
    mem[idx][g] = res;
    return res

ans = dfs(0, 0)
print (ans)

Submission status: Wrong Answer

Solution code:
from __future__ import print_function, division
d, g = map(int, raw_input().split())
g //= 100
p, c = [0], [0]
for i in xrange(d):
    u, v = map(int, raw_input().split())
    v //= 100
    p.append(u)
    c.append(v)

dp = [[10*7 for f in xrange(g + 1)] for i in xrange(d + 1)]
dp[0][0] = 0
for i in xrange(1, d + 1):
    for f in xrange(p[i] + 1):
        ad = f * i
        if f == p[i]:
            ad += c[i]
        for h in xrange(g + 1):
            dp[i][min(h + ad, g)] = min(dp[i][min(h + ad, g)], dp[i - 1][h] + f)

print(dp[d][g])

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
pcs = [[int(s) for s in input().split()] for _ in range(D)]

def calc(pcs, D, G):
    if D == 0:
        return 0
    if G <= 0:
        return 0

    t = G // (D * 100)
    
    if t <= pcs[D - 1][0]:
        if D == 1:
            return t
        else:
            return min(t, calc(pcs, D - 1, G))
    else:
        nG = G - (pcs[D - 1][0] * D * 100) - pcs[D - 1][1]
        return pcs[D - 1][0] + calc(pcs, D - 1, nG)

print(calc(pcs, D, G))

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations

def cal():
    d, g = map(int, input().split())
    a = list(permutations([[i+1]+list(map(int, input().split())) for i in range(d)]))
    ans = float('inf')

    for i in a:
        val, count = g, 0
        for a, b, c in i:
            num = 100*a*b
            if num+c >= val:
                if num >= val:
                    count += val//(100*a)
                else:
                    count += b
                break
            else:
                count += b
                val -= num+c
            if count >= ans:
                break
        ans = min(ans, count)
    print(ans)

cal()

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!

ans = 10**9


def calc(point,num, i):
    global ans
    global G, D
    if num > ans:
        return
    if point >= G:
        if num < ans:
            ans = num
        return
    if i >= D:
        return
    for j in range(problem[i][0]):
        tmp = point
        for k in range(i, D):
            tmp += (k+1)*100*problem[k][0]+problem[k][1]
        if tmp < G:
            return
        calc(point + (i+1) * 100 * j,num+j, i+1)
    calc(point + (i+1) * 100 * problem[i][0] + problem[i][1],num+problem[i][0], i+1)

D, G=map(int, input().split()) 
problem=[list(map(int,list(input().split()))) for i in range(D)]

calc(0,0,0)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!

ans = 10**9


def calc(point,num, i):
    global ans
    global G, D
    if point >= G:
        if num < ans:
            ans = num
        return
    if i >= D:
        return
    for j in range(problem[i][0]):
        tmp = point
        for k in range(i, D):
            tmp += (k+1)*100*problem[k][0]+problem[k][1]
        if tmp < G:
            return
        calc(point + (i+1) * 100 * j,num+j, i+1)
    calc(point + (i+1) * 100 * problem[i][0] + problem[i][1],num+problem[i][0], i+1)

D, G=map(int, input().split()) 
problem=[list(map(int,list(input().split()))) for i in range(D)]

calc(0,0,0)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!

ans = 10**9


def calc(point,num, i):
    global ans
    global G, D
    if point >= G:
        if num < ans:
            ans = num
        return
    if i >= D:
        return
    for j in range(problem[i][0]):
        calc(point + (i+1) * 100 * j,num+j, i+1)
    calc(point + (i+1) * 100 * problem[i][0] + problem[i][1],num+problem[i][0], i+1)

D, G=map(int, input().split()) 
problem=[list(map(int,list(input().split()))) for i in range(D)]

calc(0,0,0)

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
sys.setrecursionlimit(10**7)
D,G = map(int,input().split())
i_nproblem = [0] * D
i_bonus = [0] * D
for i in range(D):
    p,c = map(int,input().split())
    i_nproblem[i] = p
    i_bonus[i] = c

# dfs(i,prob,point) := prob問解いてpoint点で次の問題群がi、というノード以降の最小コスト(解く問題数)
def dfs(i,prob,point):
    if i == D:
        if point >= G:
            return prob
        else:
            return float('inf')
    Min = float('inf')
    for j in range(i_nproblem[i]+1):
        if j == i_nproblem[i]:
            Min = min(Min,dfs(i+1,prob+j,point+100*(i+1)*j+i_bonus[i]))
        else:
            Min = min(Min,dfs(i+1,prob+j,point+100*(i+1)*j))
    return Min
print(dfs(0,0,0))

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations

D, G = map(int, input().split())
PC = []
for _ in range(D):
    p, c = map(int, input().split())
    PC.append((p, c))

ans = sum(p for p, _ in PC)
for ids in permutations(range(D)):
    score = 0
    num = 0
    for i in ids:
        p, c = PC[i]
        if score + (i + 1) * 100 * p + c < G:
            score += (i + 1) * 100 * p + c
            num += p
        else:
            for j in range(p):
                score += (i + 1) * 100
                num += 1
                if G <= score:
                    ans = min(ans, num)
                    break
            else:
                score += c
                if G <= score:
                    ans = min(ans, num)
        if G <= score:
            break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import itertools
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
n=list(itertools.permutations(list(range(1,d+1))))
ans=1110
g//=100
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=n[i][j]
        num4=num3*p[num3-1]
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=p[num3-1]
            break
        else:
            cnt-=num4+c[num3-1]
            cnt2+=p[num3-1]
    ans=min(ans,cnt2)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import itertools
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
n=list(itertools.permutations(list(range(1,d+1))))
ans=1100
g//=100
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=n[i][j]
        num4=num3*p[num3-1]
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=p[num3-1]
            break
        else:
            cnt-=num4+c[num3-1]
            cnt2+=p[num3-1]
    ans=min(ans,cnt2)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
ans=1100
g//=100
import itertools
n=list(itertools.permutations(list(range(1,d+1))))
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        if cnt2>=ans:
            break
        num3=n[i][j]
        num4=num3*p[num3-1]
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=p[num3-1]
            break
        cnt-=num4+c[num3-1]
        cnt2+=p[num3-1]
    ans=min(ans,cnt2)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
import itertools
n=list(itertools.permutations(list(range(1,d+1))))
ans=1100
g//=100
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=n[i][j]
        num4=num3*p[num3-1]
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=p[num3-1]
            break
        else:
            cnt-=num4+c[num3-1]
            cnt2+=p[num3-1]
    ans=min(ans,cnt2)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import itertools
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
n=list(itertools.permutations(list(range(1,d+1))))
ans=2000
g//=100
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=n[i][j]
        num4=num3*p[num3-1]
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=p[num3-1]
            break
        else:
            cnt-=num4+c[num3-1]
            cnt2+=p[num3-1]
    ans=min(ans,cnt2)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import itertools
d,g=map(int,input().split())
p=[]
c=[]
for i in range(d):
    p1,c1=map(int,input().split())
    p.append(p1)
    c.append(c1//100)
n=list(itertools.permutations(list(range(1,d+1))))
ans=3000
g//=100
for i in range(len(n)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=n[i][j]
        num5=p[num3-1]
        num4=num3*num5
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+c[num3-1]>=cnt:
            cnt2+=num5
            break
        else:
            cnt-=num4+c[num3-1]
            cnt2+=num5
    ans=min(ans,cnt2)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import itertools
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for _ in range(d)]
num=list(itertools.permutations(list(range(1,d+1))))
ans=100000
for i in range(d):
    pc[i][1]=pc[i][1]//100
g//=100
for i in range(len(num)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=num[i][j]
        num5=pc[num3-1][0]
        num4=num3*num5
        if num4>=cnt:
            cnt2+=((cnt-1)//num3)+1
            break
        elif num4+pc[num3-1][1]>=cnt:
            cnt2+=num5
            break
        else:
            cnt-=num4+pc[num3-1][1]
            cnt2+=num5
    ans=min(ans,cnt2)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
from itertools import *
from math import *
input=sys.stdin.readline
D, G = map(int, input().split())
probs = [list(map(int, input().split())) for _ in range(D)]
G2 = G
seq = tuple(range(D))
x = tuple(permutations(seq, D))
infty=100000
def main():
    #print(x)
    ans = infty
    for cand in x:
        cnt = 0
        G=G2
        for ind in cand:
            probpoint = (ind + 1) * 100
            if (G<=0)or(cnt>=ans):
                break
            if G <= probpoint * (probs[ind][0] - 1):
                cnt = cnt + ceil(G / probpoint)
                G=G-probpoint*ceil(G / probpoint)
            else:
                cnt=cnt+probs[ind][0]
                G=G-(probpoint * probs[ind][0]+probs[ind][1])
        ans=min(ans,cnt)
    print(ans)

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
from itertools import *
from math import *
input=sys.stdin.readline
D, G = map(int, input().split())
probs = [list(map(int, input().split())) for _ in range(D)]
G2 = G
seq = tuple(range(D))
x = tuple(permutations(seq, D))
infty=100000
def main():
    #print(x)
    ans = infty
    for cand in x:
        cnt = 0
        G=G2
        for ind in cand:
            probpoint = (ind + 1) * 100
            if G<=0:
                break
            if G <= probpoint * (probs[ind][0] - 1):
                cnt = cnt + ceil(G / probpoint)
                G=G-probpoint*ceil(G / probpoint)
            else:
                cnt=cnt+probs[ind][0]
                G=G-(probpoint * probs[ind][0]+probs[ind][1])
        ans=min(ans,cnt)
    print(ans)

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
from itertools import *
from math import *
input=sys.stdin.readline
D, G = map(int, input().split())
probs = [list(map(int, input().split())) for _ in range(D)]
G2 = G
seq = tuple(range(D))
x = tuple(permutations(seq, D))
def main():
    #print(x)
    ans = float("inf")
    for cand in x:
        cnt = 0
        G=G2
        for ind in cand:
            probpoint = (ind + 1) * 100
            if G<=0:
                break
            if G <= probpoint * (probs[ind][0] - 1):
                cnt = cnt + ceil(G / probpoint)
                G=G-probpoint*ceil(G / probpoint)
            else:
                cnt=cnt+probs[ind][0]
                G=G-(probpoint * probs[ind][0]+probs[ind][1])
        ans=min(ans,cnt)
    print(ans)

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
from itertools import *
from math import *
input=sys.stdin.readline
D, G = map(int, input().split())
probs = [list(map(int, input().split())) for _ in range(D)]
G2 = G
def main():
    seq = list(range(D))
    x = list(permutations(seq, D))
    #print(x)
    ans = float("inf")
    for cand in x:
        cnt = 0
        G=G2
        for ind in cand:
            probpoint = (ind + 1) * 100
            if G<=0:
                break
            if G <= probpoint * (probs[ind][0] - 1):
                cnt = cnt + ceil(G / probpoint)
                G=G-probpoint*ceil(G / probpoint)
            else:
                cnt=cnt+probs[ind][0]
                G=G-(probpoint * probs[ind][0]+probs[ind][1])
        ans=min(ans,cnt)
    print(ans)

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
from itertools import *
from math import *
input=sys.stdin.readline
D, G = map(int, input().split())
probs = [list(map(int, input().split())) for _ in range(D)]
seq = list(range(D))
x = list(permutations(seq, D))
#print(x)
ans = float("inf")
G2=G
for cand in x:
    cnt = 0
    G=G2
    for ind in cand:
        probpoint = (ind + 1) * 100
        if G<=0:
            break
        if G <= probpoint * (probs[ind][0] - 1):
            cnt = cnt + ceil(G / probpoint)
            G=G-probpoint*ceil(G / probpoint)
        else:
            cnt=cnt+probs[ind][0]
            G=G-(probpoint * probs[ind][0]+probs[ind][1])
    ans=min(ans,cnt)
print(ans)