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

s0 = sum(point[0])
for j in range(len(kai[0])):
    if(s0<(j+1)*100):
        kai[0][j] = 9999
    else:
        kai[0][j] = cont((j+1)*100,point[0])

for i in range(1,len(kai)):
    for j in range(i,len(kai[0])):
        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(kai[len(kai)-1][len(kai[0])-1])

Submission status: Wrong Answer

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)

s0 = sum(point[0])
for j in range(len(kai[0])):
    if(s0<(j+1)*100):
        kai[0][j] = 9999
    else:
        kai[0][j] = cont((j+1)*100,point[i])

for i in range(1,len(kai)):
    for j in range(i,len(kai[0])):
        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[len(kai)-1][len(kai[0])-1])

Submission status: Wrong Answer

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(i+1,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(kai[len(kai)-1][len(kai[0])-1])

Submission status: Wrong Answer

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

#どの問題を完璧に解くかを全探索
bins = []  
for i in range(2**d): 
    bins.append(list(str(format(i,'b')).zfill(d)))
    
ans=0
for i in range(d):
    ans +=  pc[i][0]
for i in range(2**d):
    print(bins[i])
    tmp_num = 0
    tmp_ans = 0
    for j in range(d):
        if(bins[i][j]=='1'):
            tmp_num += pc[j][0]*100*(j+1)+pc[j][1]
            tmp_ans += pc[j][0]
        else:
            rest_max = j
    if(tmp_num>=g):
        ans = min(tmp_ans,ans)
    else:
       #print("tmp="+str(tmp_ans))
        plus = -(-(g-tmp_num)//(100*(rest_max+1)))
        if(plus<pc[rest_max][0]):
            tmp_ans += plus
            ans=min(tmp_ans,ans)
        #print("plus="+str(plus))
    #print(ans)
print(ans)

Submission status: Wrong Answer

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

#どの問題を完璧に解くかを全探索
bins = []  
for i in range(2**d): 
    bins.append(list(str(format(i,'b')).zfill(d)))
    
ans=0
for i in range(d):
    ans +=  pc[i][0]
for i in range(2**d):
    print(bins[i])
    tmp_num = 0
    tmp_ans = 0
    for j in range(d):
        if(bins[i][j]=='1'):
            tmp_num += pc[j][0]*100*(j+1)+pc[j][1]
            tmp_ans += pc[j][0]
        else:
            rest_max = j
    if(tmp_num>=g):
        ans = min(tmp_ans,ans)
    else:
       #print("tmp="+str(tmp_ans))
        plus = -(-(g-tmp_num)//(100*(rest_max+1)))
        if(plus<pc[rest_max-1][0]):
            tmp_ans += plus
            ans=min(tmp_ans,ans)
        #print("plus="+str(plus))
    #print(ans)
print(ans)

Submission status: Wrong Answer

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

#どの問題を完璧に解くかを全探索
bins = []  
for i in range(2**d): 
    bins.append(list(str(format(i,'b')).zfill(d)))
    
ans=0
for i in range(d):
    ans +=  pc[i][0]
for i in range(2**d):
    tmp_num = 0
    tmp_ans = 0
    for j in range(d):
        if(bins[i][j]=='1'):
            tmp_num += pc[j][0]*100*(j+1)+pc[j][1]
            tmp_ans += pc[j][0]
        else:
            rest_max = j
    if(tmp_num>=g):
        ans = min(tmp_ans,ans)
    else:
        plus = -(-(g-tmp_num)//(100*(rest_max+1)))
        if(plus<pc[d-1][0]):
            tmp_ans += plus
            ans=min(tmp_ans,ans)
print(ans)

Submission status: Wrong Answer

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

#どの問題を完璧に解くかを全探索
bins = []  
for i in range(2**d): 
    bins.append(list(str(format(i,'b')).zfill(d)))
    
ans=0
for i in range(d):
    ans +=  pc[i][0]
for i in range(1,2**d):
    tmp_num = 0
    tmp_ans = 0
    for j in range(d):
        if(bins[i][j]=='1'):
            tmp_num += pc[j][0]*100*(j+1)+pc[j][1]
            tmp_ans += pc[j][0]
        else:
            rest_max = j
    if(tmp_num>=g):
        ans = min(tmp_ans,ans)
    else:
        plus = -(-(g-tmp_num)//(100*(rest_max+1)))
        if(plus<pc[d-1][0]):
            tmp_ans += plus
            ans=min(tmp_ans,ans)
print(ans)

Submission status: Wrong Answer

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

#どの問題を完璧に解くかを全探索
bins = []  
for i in range(2**d): 
    bins.append(list(str(format(i,'b')).zfill(d)))
    
ans=0
for i in range(d):
    ans +=  pc[i][0]
for i in range(2**d):
    tmp_num = 0
    tmp_ans = 0
    for j in range(d):
        if(bins[i][j]=='1'):
            tmp_num += pc[j][0]*100*(j+1)+pc[j][1]
            tmp_ans += pc[j][0]
    if(tmp_num>=g):
        ans = min(tmp_ans,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
# D=2
# g=2000
# p=[[3,500],[5,800]]
D,g=map(int,input().split())
p=[list(map(int,input().split())) for i in range(D)]
q=[p[i][0] for i in range(len(p))]#[3, 5]
l=len(p)#2
A=[]
# F=1
G=0
H=[]
for i in range(D):
    A.append([100*(i+1)]*p[i][0])
    
B=[j for i in A for j in i]
for i in range(2**len(B)):
    C=[]
    for j in range(len(B)):
        if ((i>>j)&1):
            C.append(B[j])
    E=collections.Counter(C)
    J=len(C)
    for key,value in E.items():
        for k in range(D):
            if (key==100*(k+1)) and (value==q[k]):
                C.append(p[k][1])
    if sum(C)>g and G==0:
        F=J
        H=C
        G+=1
    elif sum(C)>g and len(C)<F:
        F=J
        H=C
    else:
        continue
print(F)

Submission status: Wrong Answer

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

ans = float("inf")


for bit in range(1<<d):
    count = 0
    sum = 0
    nokori = set(range(1,d+1))

    for i in range(d):
        if bit & (1<<i):
            sum +=pc[i][0]*(i+1)*100+pc[i][1]
            count +=pc[i][0]
            nokori.discard(i+1)



    if sum < g:
        use = max(nokori)
        n = min(pc[use-1][0],(g-sum)//(use*100))
        count += n
        sum += n*use *100

    if sum >= g:
        ans = min(ans,count)
print(ans)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
P=[]
C=[]
for _ in range(D):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
anss= 2**10
for i in range(1 << D):
    ans = 0
    summ = 0
    nokori = set(range(1,D+1))
    for j in range(D):
        if 1 & (i >> j):
            summ += P[j]*100*(j+1)+C[j]
            ans += P[j]
            nokori.discard(j+1)
    if summ < G:
        use = max(nokori)
        n = min(P[use-1],(G-summ)//(100*use))
        ans += n
        summ += n* use* 100

    if summ >= G:
        anss = min(ans,anss)
        
print(anss)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
P=[]
C=[]
for _ in range(D):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
anss=2**10
for i in range(1 << D):
    ans = 0
    summ = 0
    nokori = set(range(1,D+1))
    for j in range(D):
        if 1 & (i >> j):
            summ += P[j]*100*(j+1)+C[j]
            ans += P[j]
            nokori.discard(j+1)
    if summ < G:
        use = max(nokori)
        n = min(P[use-1],-((G-summ)//(100*use)))
        ans += n
        summ += n* use* 100

    if summ < G:
        summ+=C[use-1]

    if summ >= G:
        anss =min(ans,anss)
        
print(anss)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
P=[]
C=[]
for _ in range(D):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
anss=2**10
for i in range(1 << D):
    ans = 0
    summ = 0
    nokori = set(range(1,D+1))
    for j in range(D):
        if 1 & (i >> j):
            summ += P[j]*100*(j+1)+C[j]
            ans += P[j]
            nokori.discard(j+1)
    if summ < G:
        use = max(nokori)
        n = min(P[use-1],(G-summ)//(100*use))
        ans += n
        summ += n* use* 100
    if summ < G:
        summ+=C[use-1]

    if summ >= G:
        anss =min(ans,anss)
        
print(anss)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
P=[]
C=[]
for _ in range(D):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
anss=2**10
for i in range(1 << D):
    ans = 0
    summ = 0
    nokori = set(range(1,D+1))
    for j in range(D):
        if 1 & (i >> j):
            summ += P[j]*100*(j+1)+C[j]
            ans += P[j]
            nokori.discard(j+1)
    if summ < G:
        use = max(nokori)
        n = min(P[use-1],(G-summ)//(100*use))
        ans += n
        summ += n* use* 100

    if summ >= G:
        anss =min(ans,anss)
        
print(anss)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())

pc = []
for _ in range(d):
    p, c = map(int, input().split())
    pc.append([p, c])

recursion_list = []
def recursion(end_pos, status_str='', now_pos=0):
    if now_pos == end_pos:
        recursion_list.append(status_str)
        return
    
    recursion(end_pos, status_str+'0', now_pos+1)
    recursion(end_pos, status_str+'1', now_pos+1)
    return

recursion(d)

min_problem = 110
for i_status in recursion_list:
    score = 0
    num_problem = 0
    for i, i_str in enumerate(i_status):
        if i_str == '0':
            continue
        score += pc[i][1] + (i+1)*100*pc[i][0]
        num_problem += pc[i][0]
    
    if score < g:
        add_position = i_status.rfind('0')
        for j in range(1, pc[add_position][0]):
            add_score = score + (add_position+1)*100*j
            if add_score >= g:
                min_problem = min(min_problem, num_problem+j)
                break
    else:
        min_problem = min(min_problem, num_problem)
    

print(min_problem)

Submission status: Wrong Answer

Solution code:
import math

d,g=map(int,input().split())
pclist=[]
templist=[]
for i in range(d):
	templist=[]
	templist=list(map(int,input().split()))
	templist.append(templist[0]*100*(i+1)+templist[1])
	pclist.append(templist)

promin=1000

for i in range(2**d):
    gsum=0
    prosum=0
    maxind=100
    
    for j in range(d):
        if (i >> j)& 1:
            gsum += pclist[j][2]
            prosum += pclist[j][0]
        else:
            maxind=j
    if gsum >= g:
        if prosum <= promin:
            promin=prosum
    elif (gsum + (maxind+1)*100*(pclist[maxind][0]-1))>= g:
        prosum += math.floor((g-gsum)/((maxind+1)*100))
        if prosum <= promin:
            promin=prosum


print(promin)

Submission status: Wrong Answer

Solution code:
import math

d,g=map(int,input().split())
pclist=[]
templist=[]
for i in range(d):
	templist=[]
	templist=list(map(int,input().split()))
	templist.append(templist[0]*100*(i+1)+templist[1])
	pclist.append(templist)

promin=1000

for i in range(2**d):
    gsum=0
    prosum=0
    maxind=100
    
    for j in range(d):
        if (i >> j)& 1:
            gsum += pclist[j][2]
            prosum += pclist[j][0]
        else:
            maxind=j
    if gsum >= g:
        if prosum <= promin:
            promin=prosum
    elif (gsum + (maxind+1)*100*(pclist[maxind][0]-1))>= g:
        prosum += math.floor((g-gsum)//((maxind+1)*100))
        if prosum <= promin:
            promin=prosum


print(promin)

Submission status: Wrong Answer

Solution code:
# 点数は全部100で割った状態で扱う
D, G = map(int, input().split())
G //= 100
pc = []
for d in range(D):
  p, c = map(int, input().split())
  pc.append([p, c//100])


ans = 10 ** 4
# 各配点の問題に対して全問解くかどうかを全探索
for i in range(2**D):
  points = 0
  num = 0
  idx = -1
  for d in range(D):
    # bitで1が立ってる配点の問題は全問解く
    if i>>d & 1:
      points += pc[d][0]*(d+1) + pc[d][1]
      num += pc[d][0]
    else:
      idx = d
  if points >= G:
    ans = min(ans, num)
  elif idx >= 0: # これまでで点数が足りない場合、まだ解いていない問題で最も配点の高い問題で補填する
    num_add = - (- (G - points) // (idx + 1))
    print((-(G-points)) // (idx+1))
    if num_add <= pc[idx][0]:
      ans = min(ans, num + num_add)

print(ans)

Submission status: Wrong Answer

Solution code:
# 点数は全部100で割った状態で扱う
D, G = map(int, input().split())
G //= 100
pc = []
for d in range(D):
  p, c = map(int, input().split())
  pc.append([p, c//100])


ans = 10 ** 4
# 各配点の問題に対して全問解くかどうかを全探索
for i in range(2**D):
  points = 0
  num = 0
  idx = -1
  for d in range(D):
    # bitで1が立ってる配点の問題は全問解く
    if i>>d & 1:
      points += pc[d][0]*(d+1) + pc[d][1]
      num += pc[d][0]
    else:
      idx = d
  if points >= G:
    ans = min(ans, num)
  else: # これまでで点数が足りない場合、まだ解いていない問題で最も配点の高い問題で補填する
    num_add = - (- (G - points)) // (idx + 1)
    if num_add < pc[idx][0]:
      ans = min(ans, num + num_add)

print(ans)

Submission status: Wrong Answer

Solution code:
# 点数は全部100で割った状態で扱う
D, G = map(int, input().split())
G //= 100
pc = []
for d in range(D):
  p, c = map(int, input().split())
  pc.append([p, c//100])


ans = 10 ** 4
# 各配点の問題に対して全問解くかどうかを全探索
for i in range(2**D):
  points = 0
  num = 0
  idx = -1
  for d in range(D):
    # bitで1が立ってる配点の問題は全問解く
    if i>>d & 1:
      points += pc[d][0]*(d+1) + pc[d][1]
      num += pc[d][0]
    else:
      idx = d
  if points >= G:
    ans = min(ans, num)
  else: # これまでで点数が足りない場合、まだ解いていない問題で最も配点の高い問題で補填する
    num_add = - (- (G - points)) // (idx + 1)
    if num_add <= pc[idx][0]:
      ans = min(ans, num + num_add)

print(ans)

Submission status: Wrong Answer

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

ans=float('inf')
for i in range(2**D):
  score=0
  b=0
  cnt=0
  for j in range(D):
    if ((i>>j)&1):
      score+=100*(j+1)*pc[j][0]+pc[j][1]
      cnt+=pc[j][0]
    else:
      b=j
    for k in range(pc[b][0]):
      if score>=G and cnt<ans:
        ans=cnt
      score+=(b+1)*100
      cnt+=1
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = map(int,input().split())
pc = [list(map(int,input().split())) for _ in range(d)]
n = len(pc)
ans = 10**9
for i in range(2 ** n):
    cost = 0
    score = 0
    check = [False] * n

    for j in range(n):
        if ((i >> j) & 1):
            check[n - j - 1] = True

    for k in range(n):
        if check[k]:
            for l in range(pc[k][0]):
                cost += 1
                score += 100 * (k+1)
                if l == pc[k][0]-1:
                    score += pc[k][1]
                if score >= g:
                    ans = min(ans,cost)
print(ans)

Submission status: Wrong Answer

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 = deque([[] for _ in range(3)])
for i in sorted(range(d),reverse=True):
  if pc[i][0]*(i+1) >= g:
    pat[0].append(i)
  elif pc[i][0]*(i+1) + pc[i][1]//100 >= g:
    pat[1].append(i)
  else:
    pat[2].append(i)

pat = deque(pat[0] + pat[1] + pat[2])

#ans = sum([pc[x][0] for x in range(d)])
ans = float('inf')

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

dfs(pat[0],0,0,pat)
print(ans)

Submission status: Wrong Answer

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 = deque([[] for _ in range(3)])
for i in sorted(range(d),reverse=True):
  if pc[i][0]*(i+1) >= g:
    pat[0].append(i)
  elif pc[i][0]*(i+1) + pc[i][1]//100 >= g:
    pat[1].append(i)
  else:
    pat[2].append(i)

pat = deque(pat[0] + pat[1] + pat[2])

#ans = sum([pc[x][0] for x in range(d)])
ans = float('inf')

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

dfs(pat[0],0,0,pat)
print(ans)

Submission status: Wrong Answer

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 = deque([[] for _ in range(3)])
for i in sorted(range(d),reverse=True):
  if pc[i][0]*(i+1) >= g:
    pat[0].append(i)
  elif pc[i][0]*(i+1) + pc[i][1]//100 >= g:
    pat[1].append(i)
  else:
    pat[2].append(i)

pat = deque(pat[0] + pat[1] + pat[2])

#ans = sum([pc[x][0] for x in range(d)])
ans = float('inf')

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

dfs(pat[0],0,0,pat)
print(ans)

Submission status: Wrong Answer

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

#ans = sum([pc[x][0] for x in range(d)])
ans = float('inf')
for bit in range(1<<d):
  cnt = 0
  point = 0
  pat = set(range(1,d+1))
  
  for i in range(d):
    if bit & (1<<i):
      point += pc[i][0]*(i+1) + pc[i][1]//100
      cnt += pc[i][0]
      pat.discard(i+1)
  
  if point < g:
      next = max(pat)
      n = min(pc[next-1][0], math.ceil((g - point)/(next)))
      cnt += n
      point += n*(next)
    
  if point >= g:
      print(ans,cnt)
      ans = min(ans,cnt)


print(ans)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
l=[list(map(int,input().split())) for i in range(d)]
cnt=30000
for i in range(2**d):
    cntd=0
    div=i
    score=0
    allsolved=[False]*d
    for j in range(d)[::-1]:
        if div//(2**j):
            allsolved[j]=True
            cntd+=l[j][0]
            score+=100*(j+1)*l[j][0]+l[j][1]
        div%=(2**j)
    rem=max(0,g-score)
    for h in range(d)[::-1]:
        if allsolved[h]:continue
        if rem<=100*(h+1)*(l[h][0]-1):
            cntd+=rem//(100*(h+1))
            rem=0
            break
        else:
            cntd+=l[h][0]-1
            rem-=100*(h+1)*(l[h][0]-1)
    if rem<=0 and cntd < cnt:cnt=cntd
print(cnt)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    # 入力取得
    d, g = map(int, input().split())

    p = [0]*d
    c = [0]*d
    for i in range(d):
        p[i], c[i] = map(int, input().split())

    result = 99999999

    # 処理
    # ビット全探索(0:一問も解かない、1:全問解く)
    for i in range(1 << d):

        now_answer_count = 0
        now_point = 0

        # まず、全問解く問題を解いた場合の回答数と点数を取得。
        for j in range(d):
            # 全問解く場合
            # 数値 × 文字列 のパターンじゃない場合、判定条件は「i & 1 << j」でＯＫ。
            # この場合は数値 × list。
            if i & 1 << j:
                # 加算する
                # 回答数を加算
                now_answer_count += p[j]
                # 点数を加算
                now_point += p[j] * (j+1) * 100
                # コンプリートポイントを加算
                now_point += c[j]

        # print("--全問回答完了時--")
        # print(bin(i))
        # print("回答数:" + str(now_answer_count))
        # print("点数:" + str(now_point))

        # 2020/03/30 反省点
        # テストパターンb6だけ不正解。
        # 全ての問題に回答する場合の考慮が不足していた。
        # 以下のコードで対応する。
        if now_point >= g:
            result = now_answer_count

        # 次に、途中まで回答する問題を回答した場合の検証。
        j = 0
        for j in range(d):

            # print("--一部回答シュミレーション--" + str(j))
            # 全問解く場合(何もしない)
            if i & 1 << j:
                pass
            # 一問も解かない場合
            # Ｘ問回答したらどうなるか？をシュミレーションする。
            else:
                for k in range(p[j] + 1):
                    # print("回答数:" + str(k))
                    # print("加算点数:" + str(100*(j+1)*k))
                    work_now_point = 100*(j+1)*k

                    # 点数が必要点に達した場合
                    if now_point + work_now_point >= g:
                        # print("点数が足りた:")
                        # print("点数が足りた:回答数：" + str(now_answer_count + k))
                        # 回答数を更新する。
                        result = min(result, now_answer_count + k)

    print(result)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":

    # 入力取得
    d, g = map(int, input().split())

    p = [0]*d
    c = [0]*d
    for i in range(d):
        p[i], c[i] = map(int, input().split())

    result = 99999999

    # 処理
    # ビット全探索(0:一問も解かない、1:全問解く)
    for i in range(1 << d):

        now_answer_count = 0
        now_point = 0

        # まず、全問解く問題を解いた場合の回答数と点数を取得。
        for j in range(d):
            # 全問解く場合
            # 数値 × 文字列 のパターンじゃない場合、判定条件は「i & 1 << j」でＯＫ。
            # この場合は数値 × list。
            if i & 1 << j:
                # 加算する
                # 回答数を加算
                now_answer_count += p[j]
                # 点数を加算
                now_point += p[j] * (j+1) * 100
                # コンプリートポイントを加算
                now_point += c[j]

        # print("--全問回答完了時--")
        # print(bin(i))
        # print("回答数:" + str(now_answer_count))
        # print("点数:" + str(now_point))

        # 2020/03/30 反省点
        # テストパターンb6だけ不正解。
        # 全ての問題に回答する場合の考慮が不足していた。
        # 以下のコードで対応する。
        if now_point >= g:
            result = now_answer_count
            break

        # 次に、途中まで回答する問題を回答した場合の検証。
        j = 0
        for j in range(d):

            # print("--一部回答シュミレーション--" + str(j))
            # 全問解く場合(何もしない)
            if i & 1 << j:
                pass
            # 一問も解かない場合
            # Ｘ問回答したらどうなるか？をシュミレーションする。
            else:
                for k in range(p[j] + 1):
                    # print("回答数:" + str(k))
                    # print("加算点数:" + str(100*(j+1)*k))
                    work_now_point = 100*(j+1)*k

                    # 点数が必要点に達した場合
                    if now_point + work_now_point >= g:
                        # print("点数が足りた:")
                        # print("点数が足りた:回答数：" + str(now_answer_count + k))
                        # 回答数を更新する。
                        result = min(result, now_answer_count + k)

    print(result)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    # 入力取得
    d, g = map(int, input().split())
 
    p = [0]*d
    c = [0]*d
    for i in range(d):
        p[i], c[i] = map(int, input().split())
 
    result = 99999999
 
    # 処理
    # ビット全探索(0:一問も解かない、1:全問解く)
    for i in range(1 << d):
 
        now_answer_count = 0
        now_point = 0
 
        # まず、全問解く問題を解いた場合の回答数と点数を取得。
        for j in range(d):
            # 全問解く場合
            # 数値 × 文字列 のパターンじゃない場合、判定条件は「i & 1 << j」でＯＫ。
            # この場合は数値 × list。
            if i & 1 << j:
                # 加算する
                # 回答数を加算
                now_answer_count += p[j]
                # 点数を加算
                now_point += p[j] * (j+1) * 100
                # コンプリートポイントを加算
                now_point += c[j]
 
        # print("--全問回答完了時--")
        # print(bin(i))
        # print("回答数:" + str(now_answer_count))
        # print("点数:" + str(now_point))
 
        # 次に、途中まで回答する問題を回答した場合の検証。
        j = 0
        for j in range(d):
 
            # print("--一部回答シュミレーション--" + str(j))
            # 全問解く場合(何もしない)
            if i & 1 << j:
                pass
            # 一問も解かない場合
            # Ｘ問回答したらどうなるか？をシュミレーションする。
            else:
                for k in range(p[j] + 1):
                    # print("回答数:" + str(k))
                    # print("加算点数:" + str(100*(j+1)*k))
                    work_now_point = 100*(j+1)*k
 
                    # 点数が必要点に達した場合
                    if now_point + work_now_point >= g:
                        # print("点数が足りた:")
                        # print("点数が足りた:回答数：" + str(now_answer_count + k))
                        # 回答数を更新する。
                        result = min(result, now_answer_count + k)
 
    print(result)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    # 入力取得
    d, g = map(int, input().split())

    p = [0]*d
    c = [0]*d
    for i in range(d):
        p[i], c[i] = map(int, input().split())

    result = 999999

    # 処理
    # ビット全探索(0:一問も解かない、1:全問解く)
    for i in range(1 << d):

        now_answer_count = 0
        now_point = 0

        # まず、全問解く問題を解いた場合の回答数と点数を取得。
        for j in range(d):
            # 全問解く場合
            # 数値 × 文字列 のパターンじゃない場合、判定条件は「i & 1 << j」でＯＫ。
            # この場合は数値 × list。
            if i & 1 << j:
                # 加算する
                # 回答数を加算
                now_answer_count += p[j]
                # 点数を加算
                now_point += p[j] * (j+1) * 100
                # コンプリートポイントを加算
                now_point += c[j]

        # print("--全問回答完了時--")
        # print(bin(i))
        # print("回答数:" + str(now_answer_count))
        # print("点数:" + str(now_point))

        # 次に、途中まで回答する問題を回答した場合の検証。
        j = 0
        for j in range(d):

            # print("--一部回答シュミレーション--" + str(j))
            # 全問解く場合(何もしない)
            if i & 1 << j:
                pass
            # 一問も解かない場合
            # Ｘ問回答したらどうなるか？をシュミレーションする。
            else:
                for k in range(p[j] + 1):
                    # print("回答数:" + str(k))
                    # print("加算点数:" + str(100*(j+1)*k))
                    work_now_point = 100*(j+1)*k

                    # 点数が必要点に達した場合
                    if now_point + work_now_point >= g:
                        # print("点数が足りた:")
                        # print("点数が足りた:回答数：" + str(now_answer_count + k))
                        # 回答数を更新する。
                        result = min(result, now_answer_count + k)

    print(result)

Submission status: Wrong Answer

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

min_n=10**9
n = 0
s=0
for ind in range(2**D):
  n=0
  s=0
  for j in range(D):
    if ind>>j & 1:
      s += (j+1)*100*li[j][0]+li[j][1]
      n+=li[j][0]
  # print(s)
  if s < G:
    for j in range(D-1,-1,-1):
      if ind>>j & 1 == 0:
        tmp = (G-s) / ((j+1)*100)
        if (G-s) % ((j+1)*100) != 0:
          tmp += 1
        if tmp > 0:
          if tmp==li[j][1]:
            tmp -=1
          s += (j+1)*100*tmp
          n+= tmp
      if s >= G:
        break
  if s >= G:
    if n<min_n:
      # print(ind)
      min_n=n

print(int(min_n))