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=[ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(D) ]

import itertools as ite
cmin = 100000000000000000
for cli in ite.product( *([[0,1]]*D) ):
  
  s = 0
  c = 0
  for i in range(D):
    if cli[i]==1:
      s +=  li[i][1] + (i+1)*100*li[i][0]
      c +=  li[i][0]
  #print ( s ,c )
  
  ds = G-s
  
  for i in range(D-1,-1,-1):
    if (ds<=0):
      break
    if cli[i]==0:
      toku = (ds-1)//((i+1)*100)+1
      toku = min(toku,li[i][0])
      c += toku
      ds -= toku*(i+1)*100
    if (ds<=0):
      cmin = min(cmin,c)
print (cmin)

Submission status: Wrong Answer

Solution code:
n,g=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(n)]
comp=[(100*(i+1)*arr[i][0]+arr[i][1]) for i in range(n)]
ans=10**10
for i in range(2**n):
  flag=format(i,'b')
  if len(flag)<n:
    flag='0'*(n-len(flag))+flag
  tsum=0
  tans=0
  for i in range(n):
    if flag[i]=='1':
      tsum+=comp[i]
      tans+=arr[i][0]
  if tsum>=g:
    ans=min(ans,tans)
  else:
    pos=flag[::-1].index('0')
    tq=(g-tsum)//(100*(n-pos))
    if tq<=arr[n-pos-1][0]:
      ans=min(ans,tans+tq)
print(ans)

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)
ans=float("inf")
for i in range(2**d):
  count,pt=0,0
  key=str(bin(i))[2:].zfill(d)
  for j in range(d):
    if key[j]=="1":
      count+=P[j]
      pt+=P[j]*(j+1)*100+C[j]
  if pt>=g:
    ans=min(ans,count)
  else:
    for k in range(d):
      ind=d-(k+1)
      if key[ind]=="0":
        if pt+P[ind]*(ind+1)*100>=g:
          count+=(g-pt-1)//((ind+1)*100)+1
          ans=min(ans,count)
        else:
          count+=P[ind]
          pt+=P[ind]*(ind+1)*100+C[ind]
          if pt>=g:
            ans=min(ans,count)
print(ans)

Submission status: Wrong Answer

Solution code:
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def calc_bitmap(i):
    ret = []
    for j in range(10):
        ret.append((i>>j) & 1)
    return ret


def completes(pclist, bitmap):
    count = 0
    score = 0
    for i, bit in enumerate(bitmap):
        if bit:
            count += pclist[i][0]
            score += ((i+1)*100) * pclist[i][0]
            score += pclist[i][1]
    return count, score


def not_completes(pclist, bitmap, score):
    count = 0
    lbitmap = []
    for i, bit in enumerate(bitmap):
        if not bit:
            lbitmap.append(i)
    for i in reversed(lbitmap):
        if score <= 0:
            return count
        if pclist[i][0] > 0:
            if score - ((i+1)*100) * (pclist[i][0] - 1) <= 0:
                if score % ((i+1)*100):
                    count += score // ((i+1)*100) + 1
                else:
                    count += score // ((i+1)*100)
                return count
            count += pclist[i][0] - 1
            score -= (pclist[i][0] - 1) * ((i+1)*100)
    return float('inf')


def main():
    d, g = intin()
    pclist = intinl(d)

    while len(pclist) < 10:
        pclist.append((0, 0))
    min_count = float('inf')

    for i in range(2**10):
        bitmap = calc_bitmap(i)
        ccount, score = completes(pclist, bitmap)
        ncount = not_completes(pclist, bitmap, g - score)
        min_count = min(min_count, ccount + ncount)

    print(min_count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
###############################################################################

from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict


mod = 1


def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * y) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def combination(x, y):
    assert(x >= y)

    if y > x // 2:
        y = x - y

    ret = 1

    for i in range(0, y):
        j = x - i
        i = i + 1

        ret = ret * j
        ret = ret // i

    return ret


def get_divisors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    retlist.append(x)
    return retlist


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def calc_bitmap(i):
    ret = []
    for j in range(10):
        ret.append((i>>j) & 1)
    return ret


def completes(pclist, bitmap):
    count = 0
    score = 0
    for i, bit in enumerate(bitmap):
        if bit:
            count += pclist[i][0]
            score += ((i+1)*100) * pclist[i][0]
            score += pclist[i][1]
    return count, score


def not_completes(pclist, bitmap, score):
    count = 0
    lbitmap = []
    for i, bit in enumerate(bitmap):
        if not bit:
            lbitmap.append(i)
    for i in reversed(lbitmap):
        if score <= 0:
            return count
        if score - ((i+1)*100) * (pclist[i][0] - 1) <= 0:
            if score % ((i+1)*100):
                count += score // ((i+1)*100) + 1
            else:
                count += score // ((i+1)*100)
            return count
        if pclist[i][0] > 0:
            count += pclist[i][0] - 1
            score -= (pclist[i][0] - 1) * ((i+1)*100)
    return float('inf')


def main():
    d, g = intin()
    pclist = intinl(d)

    while len(pclist) < 10:
        pclist.append((0, 0))
    min_count = float('inf')

    for i in range(2**10):
        bitmap = calc_bitmap(i)
        ccount, score = completes(pclist, bitmap)
        ncount = not_completes(pclist, bitmap, g - score)
        min_count = min(min_count, ccount + ncount)

    print(min_count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def Search(g,L,i):
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 99999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    S=g-pS
    pC+=min(C-pC,(S-1)//100//L[i+1][0]+1,Search(S,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
l=[]
k=[]
n=N=99999
for i in range(d):
    p,c=map(int,input().split())
    K=(i+1)*100*p+c
    if K >g:
        l.append((i+1,p,c,K//p))
        L.append((i+1,p,c,(i+1)*100))
    else:
        L.append((i+1,p,c,K//p))
if len(l)!=0:
    l.sort(key=lambda x:-x[1])
    n=Search(g,l,len(l)-1)
L.sort(key=lambda x:x[3])
N=Search(g,L,len(L)-1)
print(min(n,N))

Submission status: Wrong Answer

Solution code:
def Search(g,L,i):
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 99999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    S=g-pS
    pC+=min(C-pC,(S-1)//100//L[i+1][0]+1,Search(S,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
l=[]
n=N=99999
for i in range(d):
    p,c=map(int,input().split())
    K=(i+1)*100*p+c
    if K >g:l.append((i+1,p,c,K//p))
    else:L.append((i+1,p,c,K//p))
if len(l)!=0:
    l.sort(key=lambda x:x[3])
    L.append(l[-1])
    l.sort(key=lambda x:-x[1])
    n=Search(g,l,len(l)-1)
L.sort(key=lambda x:x[3])
N=Search(g,L,len(L)-1)
print(min(n,N))

Submission status: Wrong Answer

Solution code:
def Search(g,L,i):
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 99999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    S=g-pS
    pC+=min(C-pC,(S-1)//100//L[i+1][0]+1,Search(S,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
l=[]
n=N=99999
for i in range(d):
    p,c=map(int,input().split())
    K=(i+1)*100*p+c
    if K >g:l.append((i+1,p,c,K//p))
    else:L.append((i+1,p,c,K//p))
if len(l)!=0:
    L.append(l[-1])
    l.sort(key=lambda x:-x[1])
    n=Search(g,l,len(l)-1)
L.sort(key=lambda x:x[3])
N=Search(g,L,len(L)-1)
print(min(n,N))

Submission status: Wrong Answer

Solution code:
def Search(g,L,i):
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 99999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    S=g-pS
    pC+=min(C-pC,(S-1)//100//L[i+1][0]+1,Search(S,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
l=[]
n=N=9999
for i in range(d):
    p,c=map(int,input().split())
    K=(i+1)*100*p+c
    if K >g:l.append((i+1,p,c))
    else:L.append((i+1,p,c,K//p))
if len(l)!=0:
    l.sort(key=lambda x:-x[1])
    n=Search(g,l,len(l)-1)
if len(L)!=0:
    L.sort(key=lambda x:x[3])
    N=Search(g,L,len(L)-1)
print(min(n,N))

Submission status: Wrong Answer

Solution code:
def Search(g,L,i):
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 99999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    S=g-pS
    pC+=min(C-pC,(S-1)//100//L[i+1][0]+1,Search(S,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
for i in range(d):
    p,c=map(int,input().split())
    L.append((i+1,p,c,(i+1)*100+c//p))
L.sort(key=lambda x:x[2])
print(Search(g,L,i))

Submission status: Wrong Answer

Solution code:
def Search(g,L,i):
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 99999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    S=g-pS
    pC+=min(C-pC,(S-1)//100//L[i+1][0]+1,Search(S,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
for i in range(d):
    p,c=map(int,input().split())
    L.append((i+1,p,c,(i+1)*100*p+c))
L.sort(key=lambda x:x[2])
print(Search(g,L,i))

Submission status: Wrong Answer

Solution code:
def Search(g,L,i):
    if i<0:return 99999
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 99999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    S=g-pS
    pC+=min(C-pC,((S-1)//100//L[i+1][0]+1),Search(S,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
for i in range(d):
    p,c=map(int,input().split())
    L.append((i+1,p,c))
print(Search(g,L,i))

Submission status: Wrong Answer

Solution code:
def Search(g,L,i):
    if i<0:return 9999
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 9999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    pC+=min(C,((g-pS-1)//100//L[i+1][0]+1),Search(g-pS,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
for i in range(d):
    p,c=map(int,input().split())
    L.append((i+1,p,c))
print(Search(g,L,i))

Submission status: Wrong Answer

Solution code:
def Search(g,L,i):
    if i<0:return 9999
    pS=pC=S = C = 0
    while g > S:
        if i < 0: return 9999
        pS=S
        pC=C
        S+=L[i][0]*L[i][1]*100
        if g > S:
            S+=L[i][2]
        C+=L[i][1]
        i-=1
    print(C,pC,g-pS,L[:i+1],i)
    pC+=min(C,((g-pS-1)//100//L[i+1][0]+1),Search(g-pS,L[:i+1],i))
    return pC
d,g=map(int,input().split())
L=[]
for i in range(d):
    p,c=map(int,input().split())
    L.append((i+1,p,c))
print(Search(g,L,i))

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P = []
for i in range(1, D+1):
    p, c = map(int, input().split())
    points = i * 100
    ac = points * p + c
    P.append([points, p, ac])

ans = float('inf')
for i in range(1<<D):
    score = 0
    max_unsolve = 0
    step = 0
    is_accepted = True
    for j in range(D):
        if (i >> j) & 1:
            if score > G:
                is_accepted = False
                break
            score += P[j][2]
            step += P[j][1]
            if step > ans:
                is_accepted = False
                break
        else:
            max_unsolve = j
    if is_accepted:
        if G - score < P[max_unsolve][2]:
            step += min(P[max_unsolve][1], (G-score-1)//P[max_unsolve][0]+1)
            ans = min(step, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

ans = 10 ** 12

def ans_check(ans_dic_data, goal):
    global ans
    for num, value in ans_dic_data.items():
        if value >= goal:
            if num < ans:
                ans = num

def main():
    num, goal = map(int, input().split())

    ans_dic = [defaultdict(int) for i in range(num + 1)]

    data = list(map(int, input().split()))
    ans_dic[1][0] = 0
    for i in range(1, data[0] + 1):
        ans_dic[1][i] = i * 100
    ans_dic[1][data[0]] += data[1]
    ans_check(ans_dic[1], goal)

    # print(ans_dic)

    for i in range(2, num + 1):
        data = list(map(int, input().split()))
        ans_dic[i][0] = 0
        for j in range(1, data[0] + 1):
            now_data = 100 * i * j
            if j == data[0]:
                now_data += data[1]
            pre_data = ans_dic[i - 1][j]
            ans_dic[i][j] = max(now_data, pre_data)
        for key_num in ans_dic[i - 1].keys():
            if key_num == 0 or ans_dic[i - 1][key_num] == 0:
                continue
            ans_dic[i][data[0] + key_num] = ans_dic[i-1][key_num] + 100 * i * data[0] + data[1]
        ans_check(ans_dic[i], goal)

    # print(ans_dic)
    global ans

    print(ans)



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
D,G = map(int, input().split())
pclist = [list(map(int, input().split())) for _ in range(D)] + [[0,0]]
bits=[format(i, '0'+str(D)+'b') for i in range(2**D)]
ans = 10**5
for bit in bits:
    resn = 0
    res = 0
    maxi = bit.rfind('0')+1
    for i, b in enumerate(bit):
        if b == '1':
            resn += pclist[i][0]
            res += pclist[i][0]*100*(i+1)+pclist[i][1]
    if maxi > 0 and res+(pclist[maxi-1][0]-1)*100*maxi >= G:
        if G-res > 0:
            resn += math.ceil((G-res)/(100*maxi))
        if resn < ans:
            ans = resn
print(ans)

Submission status: Wrong Answer

Solution code:
import math
D,G = map(int, input().split())
pclist = [list(map(int, input().split())) for _ in range(D)] + [[0,0]]
bits=[format(i, '0'+str(D)+'b') for i in range(2**D)]
ans = 10**5
for bit in bits:
    maxi = D
    resn = 0
    res = 0
    maxi = bit.rfind('0')+1
    for i, b in enumerate(bit):
        if b == '1':
            resn += pclist[i][0]
            res += pclist[i][0]*100*(i+1)+pclist[i][1]
    if maxi > 0 and res+(pclist[maxi-1][0]-1)*100*maxi >= G:
        if G-res > 0:
            resn += math.ceil((G-res)/(100*maxi))
        if resn < ans:
            ans = resn
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import numpy as np
import math
import re

n = input()
n = re.split(" ",n)
D = int(n[0])
G = int(n[1])

p = []
c = []
for i in range(D):
    x = input()
    x = re.split(" ",x)
    x = list(map(int,x))
    p.append(x[0])
    c.append(x[1])
min1 = 1000000
min2 = 1000000
sum = 0
count = 0
for i in reversed(range(D)):
    for j in range(p[i]):
        sum += 100*(i+1)
        count += 1
        if(sum >= G):
            if count < min1:
                min1 = count
                sum = 0
                count = 0
            break;
    if sum !=0 and sum < G:
        sum += c[i]
        if sum >= G:
            if count < min1:
                min1 = count
            sum = 0
            count = 0

count = 0
for i in range(D):
    flag = 0
    sum = 0
    counting = 0
    count += 1
    for j in range(p[i]):
        counting += 1
        sum += count*100
        if( sum >= G ):
            flag = 1
            break;
    if flag == 0:
        sum += c[i]
        if(sum >= G):
            flag = 1
    if(flag == 1 and counting < min2):
        min2 = counting
print(min(min1,min2))

Submission status: Wrong Answer

Solution code:
from math import ceil

class Score():
    def __init__(self, score, num, bonus):
        self.num = num
        self.score = score
        self.bonus = bonus

D, G = [int(c) for c in input().split(" ")]
min_times = 100000000000

def dfs(score_lists, masks: list, num: int, sum_score, sum_use_num):
    """completeするかしないかで2^Dを選んでいく
    """
    if (num == D):
        # print(sum_score)
        for i in range(D - 1, -1, -1):
            if (masks[i] == 1):
                continue
            else:
                global min_times
                if sum_score >= G:
                    min_times = min(min_times, sum_use_num)
                elif sum_score + (score_lists[i].num)* score_lists[i].score < G:
                    # break
                    continue
                else:
                    score = sum_score
                    j = 0
                    while (True):
                        j += 1
                        score += score_lists[i].score
                        if score >= G:
                            min_times = min(min_times, j + sum_use_num)
                            break
                    break
                    # min_times = min(sum_use_num + ceil((G - sum_score) / score_lists[i].score), min_times)
                    # break
                    
    else:
        masks[num] = 0
        dfs(score_lists, masks, num + 1, sum_score, sum_use_num)

        masks[num] = 1
        dfs(score_lists, masks, num + 1, \
            sum_score + score_lists[num].num * score_lists[num].score + score_lists[num].bonus, \
            sum_use_num + score_lists[num].num)


score_lists = []
min_num = 0
for i in range(D):
    p, c = [int(c) for c in input().split(" ")]
    score = 100 * (i + 1)
    scores = Score(score, p, c)
    score_lists.append(scores)

masks = [0] * D
dfs(score_lists, masks, 0, 0, 0)

print(min_times)

Submission status: Wrong Answer

Solution code:
from math import ceil

class Score():
    def __init__(self, score, num, bonus):
        self.num = num
        self.score = score
        self.bonus = bonus

D, G = [int(c) for c in input().split(" ")]
min_times = 100000000000

def dfs(score_lists, masks: list, num: int, sum_score, sum_use_num):
    """completeするかしないかで2^Dを選んでいく
    """
    if (num == D):
        # print(sum_score)
        for i in range(D - 1, -1, -1):
            if (masks[i] == 1):
                continue
            else:
                global min_times
                if sum_score >= G:
                    min_times = min(min_times, sum_use_num)
                elif sum_score + (score_lists[i].num)* score_lists[i].score < G:
                    # break
                    continue
                else:
                    min_times = min(sum_use_num + ceil((G - sum_score) / score_lists[i].score), min_times)
                    # break
                    
    else:
        masks[num] = 0
        dfs(score_lists, masks, num + 1, sum_score, sum_use_num)

        masks[num] = 1
        dfs(score_lists, masks, num + 1, \
            sum_score + score_lists[num].num * score_lists[num].score + score_lists[num].bonus, \
            sum_use_num + score_lists[num].num)


score_lists = []
min_num = 0
for i in range(D):
    p, c = [int(c) for c in input().split(" ")]
    score = 100 * (i + 1)
    scores = Score(score, p, c)
    score_lists.append(scores)

masks = [0] * D
dfs(score_lists, masks, 0, 0, 0)

print(min_times)

Submission status: Wrong Answer

Solution code:
from math import ceil

class Score():
    def __init__(self, score, num, bonus):
        self.num = num
        self.score = score
        self.bonus = bonus

D, G = [int(c) for c in input().split(" ")]
min_times = 100000000

def dfs(score_lists, masks: list, num: int, sum_score, sum_use_num):
    """completeするかしないかで2^Dを選んでいく
    """
    if (num == D):
        # print(sum_score)
        for i in range(D - 1, -1, -1):
            if (masks[i] == 1):
                continue
            else:
                global min_times
                if sum_score >= G:
                    min_times = min(min_times, sum_use_num)
                elif sum_score + (score_lists[i].num - 1)* score_lists[i].score < G:
                    # break
                    continue
                else:
                    min_times = min(sum_use_num + ceil((G - sum_score) / score_lists[i].score), min_times)
                    # break
                    
    else:
        masks[num] = 0
        dfs(score_lists, masks, num + 1, sum_score, sum_use_num)

        masks[num] = 1
        dfs(score_lists, masks, num + 1, \
            sum_score + score_lists[num].num * score_lists[num].score + score_lists[num].bonus, \
            sum_use_num + score_lists[num].num)


score_lists = []
min_num = 0
for i in range(D):
    p, c = [int(c) for c in input().split(" ")]
    score = 100 * (i + 1)
    scores = Score(score, p, c)
    score_lists.append(scores)

masks = [0] * D
dfs(score_lists, masks, 0, 0, 0)

print(min_times)

Submission status: Wrong Answer

Solution code:
from math import ceil

class Score():
    def __init__(self, score, num, bonus):
        self.num = num
        self.score = score
        self.bonus = bonus

D, G = [int(c) for c in input().split(" ")]
min_times = 100000000

def dfs(score_lists, masks: list, num: int, sum_score, sum_use_num):
    """completeするかしないかで2^Dを選んでいく
    """
    if (num == D):
        # print(sum_score)
        for i in range(D - 1, -1, -1):
            if (masks[i] == 1):
                continue
            else:
                global min_times
                if sum_score >= G:
                    min_times = min(min_times, sum_use_num)
                elif sum_score + score_lists[i].num * score_lists[i].score < G:
                    # break
                    continue
                else:
                    min_times = min(sum_use_num + ceil((G - sum_score) / score_lists[i].score), min_times)
                    # break
                    
    else:
        masks[num] = 0
        dfs(score_lists, masks, num + 1, sum_score, sum_use_num)

        masks[num] = 1
        dfs(score_lists, masks, num + 1, \
            sum_score + score_lists[num].num * score_lists[num].score + score_lists[num].bonus, \
            sum_use_num + score_lists[num].num)


score_lists = []
min_num = 0
for i in range(D):
    p, c = [int(c) for c in input().split(" ")]
    score = 100 * (i + 1)
    scores = Score(score, p, c)
    score_lists.append(scores)

masks = [0] * D
dfs(score_lists, masks, 0, 0, 0)

print(min_times)

Submission status: Wrong Answer

Solution code:
from math import ceil

class Score():
    def __init__(self, score, num, bonus):
        self.num = num
        self.score = score
        self.bonus = bonus

D, G = [int(c) for c in input().split(" ")]
min_times = 100000000

def dfs(score_lists, masks: list, num: int, sum_score, sum_use_num):
    """completeするかしないかで2^Dを選んでいく
    """
    if (num == D):
        # print(sum_score)
        for i in range(D - 1, -1, -1):
            if (masks[i] == 1):
                continue
            else:
                global min_times
                if sum_score >= G:
                    min_times = min(min_times, sum_use_num)
                elif sum_score + score_lists[i].num * score_lists[i].score < G:
                    break
                else:
                    min_times = min(sum_use_num + ceil((G - sum_score) / score_lists[i].score), min_times)
                    # break
                    
    else:
        masks[num] = 0
        dfs(score_lists, masks, num + 1, sum_score, sum_use_num)

        masks[num] = 1
        dfs(score_lists, masks, num + 1, \
            sum_score + score_lists[num].num * score_lists[num].score + score_lists[num].bonus, \
            sum_use_num + score_lists[num].num)


score_lists = []
min_num = 0
for i in range(D):
    p, c = [int(c) for c in input().split(" ")]
    score = 100 * (i + 1)
    scores = Score(score, p, c)
    score_lists.append(scores)

masks = [0] * D
dfs(score_lists, masks, 0, 0, 0)

print(min_times)