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:
#スコアg以上にしたい
import math
d,g = list(map(int, input().split()))
pca = []
for i in range(1,d+1):
    p,c = list(map(int, input().split()))
    pca.append((p,c,100*i*p+c,100*i))
    

ls = [0]*d
param_list = [0]*2**d
for i in range(2**d):
    l = [False]*d
    for id_r, row in enumerate(ls):
        if i & (2 ** id_r) >0:
            l[id_r] = True
    param_list[i] = l 

ans = 10**8
for an in param_list:
    pcs = pca.copy()
    score = 0
    num = 0
    for i in range(d-1,-1,-1):
        if an[i]:
            score += pcs[i][2]
            num += pcs[i][0]
            pcs.pop(i)

    if score >= g:
        ans = min(ans,num)
    elif len(an) > 0 and g > score:
        k =  math.floor((g-score)/pcs[-1][3])
        if k <= pcs[-1][0]:
            num += k
            ans = min(ans,num)
    
        
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
from typing import List, Tuple


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

    print(ag(v, g))


def ag(v: List[Tuple[int, int]], g: int) -> int:
    # ex. [(3, 500), (5, 800)] -> [(1, 3, 500), (2, 5, 800)]
    v = [(i + 1, v[i][0], v[i][1]) for i in range(len(v))]

    result = 100 ** 10

    for j in range(len(v)):
        for cb in itertools.combinations(v, j):
            sc = 0
            cnt = 0
            # calc bonus score
            for (i, p, c) in cb:
                sc += i * 100 * p + c
                cnt += p

            for idx in reversed(range(len(v))):
                if sc >= g:
                    break
                if v[idx] in cb:
                    continue
                i, p, _ = v[idx]
                for _ in range(p - 1):
                    if sc >= g:
                        break
                    sc += i * 100
                    cnt += 1

            if sc >= g:
                result = min(result, cnt)
    return result


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
import math
ans=10**9
prob=[]
for i in range(D):
  p,c=map(int,input().split())
  prob.append((p,c))
for i in range(2**D):
  i=format(i-1,'b').rjust(D,'0')
  alll=[]
  notall=[]
  for j in range(D):
    if i[j]=='1':
      alll.append(j)
    else:
      notall.append(j)
  if notall!=[]:
    maxnotall=notall[-1]  
  point=0
  tans=0
  for i in alll:
    point+=100*(i+1)*prob[i][0]+prob[i][1]
    tans+=prob[i][0]
  if point>=G:
    ans=min(tans,ans)
  if point<G:
    if 100*(maxnotall+1)*(prob[maxnotall][0]-1)>=G-point:
      tans+=math.ceil((G-point)/(100*(maxnotall+1)))
      ans=min(tans,ans)
    else:
      ans=ans

if ans==10*9:
  ans=0
  for i in range(N):
    ans+=prob[i][0]
print(ans)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
import math
ans=10**9
prob=[]
for i in range(D):
  p,c=map(int,input().split())
  prob.append((p,c))
for i in range(2**D):
  i=format(i-1,'b').rjust(D,'0')
  alll=[]
  notall=[]
  for j in range(D):
    if i[j]=='1':
      alll.append(j)
    else:
      notall.append(j)
  if notall!=[]:
    maxnotall=notall[-1]  
  point=0
  tans=0
  for i in alll:
    point+=100*(i+1)*prob[i][0]+prob[i][1]
    tans+=prob[i][0]
  if point>=G:
    ans=min(tans,ans)
  if point<G:
    if 100*(maxnotall+1)*(prob[maxnotall][0]-1)>=G-point:
      tans+=math.ceil((G-point)/(100*(maxnotall+1)+1))
      ans=min(tans,ans)
    else:
      ans=ans

if ans==10*9:
  ans=0
  for i in range(N):
    ans+=prob[i][0]
print(ans)

Submission status: Wrong Answer

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=1000
for i in range(len(num)):
    cnt=g
    cnt2=0
    for j in range(d):
        num3=num[i][j]
        num4=num3*100*pc[num3-1][0]
        if num4>=cnt:
            cnt2+=cnt//(100*num3)
            break
        elif num4+pc[num3-1][1]>=cnt:
            cnt2+=pc[num3-1][0]
            break
        else:
            cnt-=num4+pc[num3-1][1]
            cnt2+=pc[num3-1][0]
    ans=min(ans,cnt2)
print(ans)

Submission status: Wrong Answer

Solution code:
d,G = map(int,input().split())
g = G//100
plist = [list() for _ in range(d)]
pp = []
pe = []
for i in range(d):
    p,C = map(int,input().split())
    c = C//100
    pp += [p]
    if p==1:
        pe += [i]
    plist[i] += [i+1]*(p-1)
    plist[i] += [i+1+c]

poli = [list() for _ in range(d)]
#poave = []
for i in range(d):
    poli[i] += [plist[i][0]]
    for j in range(pp[i]-1):
        poli[i] += [poli[i][j]+plist[i][j+1]]
    #poave += [poli[i][-1]/pp[i]]

import math
numli = []
for i in range(2**d):
    kari = 0
    nkanli = []
    karimon = 0
    #print("次のiいくよー"+"i:"+str(i)+",2進法で"+str(bin(i))[2:])
    for j in range(d):
        if (i>>j)&1 == 1:
            #print("下から"+str(j+1)+"桁目は1,つまり,index"+str(j)+"が1だね")
            kari += poli[j][-1]
            karimon += pp[j]
        else:
            nkanli +=[j]
    if kari>=g:
        numli += [karimon]
    else:
        if nkanli == []:
            continue
        else:
            for k in range(len(nkanli)-1,-1,-1):
                if nkanli[k] in pe:
                    continue
                else:
                    if kari + poli[nkanli[k]][-2]>=g:
                        #print("わーいわーい")
                        karimon += math.ceil((g-kari)//(nkanli[k]+1))
                        numli += [karimon]
                        break
                    else:
                        break
    #print(kari,nkanli,karimon)
#print(numli)
print(min(numli))

Submission status: Wrong Answer

Solution code:
import itertools
D, G = map(int, input().split())
#ans = 10000000000
ans = []
list_pro = [list(map(int, input().split())) for _ in range(D)]
for ptr in itertools.product([0,1], repeat=D):
  cnt_pro = 0
  res = 0
  for i,k in enumerate(ptr):
    if k == 1:
      cnt_pro += list_pro[i][0]
      res += 100 * (i+1) * list_pro[i][0] + list_pro[i][1]
  if res < G:
    for j, l in enumerate(reversed(ptr)):
      if l == 0:
        for _ in range(list_pro[D-1-j][0]):
          if res >= G:
            break
          res += 100 * (D-j)
          cnt_pro += 1      
  if res >= G:
    ans.append((cnt_pro, ptr))
print(ans)

Submission status: Wrong Answer

Solution code:
import sys,math,collections,itertools,copy
input = sys.stdin.readline

D,G=list(map(int,input().split()))
score = []
maxScore = []
cos_per = []
for d in range(D):
    p,c=map(int,input().split())
    tmp = [(d+1)*100]*p
    tmp[-1]+=c
    score.append(tmp)
    maxScore.append(sum(tmp))
    #cos_per.append([d+1,sum(tmp)/p])
    cos_per.append([d+1,d+1])
#-最大いくつの問題セットを必要とするか-#
maxScore.sort()
tmp = 0
for idx,mS in enumerate(maxScore):
    tmp += mS
    if tmp >= G:
        max_num = idx+1
        break
#-最小でいくつの問題セットを必要とするか-#
tmp = 0
j=0
for i in range(len(maxScore)-1,-1,-1):
    j+=1
    tmp += maxScore[i]
    if tmp >= G:
        min_num = j
        break
#-最小-2個はスコアが高いものを入れてよし-#
cos_per.sort(key = lambda x:-x[1])
choice = set(range(1,D+1))
choiceList = []
for i in range(0,min_num-3):
    choiceList+=score[cos_per[i][0]-1]
    choice.discard(cos_per[i][0])
    max_num -=1
 
#-足し上げる-#

ans = float('inf')
for ch in itertools.permutations(choice,max_num):
    tmp = []
    for ci in ch:
        tmp+=score[ci-1]
    times = 0
    total = 0
    for sc in tmp:
        total += sc
        times += 1
        if total >= G:
            ans = min(ans,times)
            break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys,math,collections,itertools,copy
input = sys.stdin.readline

D,G=list(map(int,input().split()))
score = []
maxScore = []
cos_per = []
for d in range(D):
    p,c=map(int,input().split())
    tmp = [(d+1)*100]*p
    tmp[-1]+=c
    score.append(tmp)
    maxScore.append(sum(tmp))
    cos_per.append([d+1,sum(tmp)/p])
    #cos_per.append([d+1,d+1])
#-最大いくつの問題セットを必要とするか-#
maxScore.sort()
tmp = 0
for idx,mS in enumerate(maxScore):
    tmp += mS
    if tmp >= G:
        max_num = idx+1
        break
#-最小でいくつの問題セットを必要とするか-#
tmp = 0
j=0
for i in range(len(maxScore)-1,-1,-1):
    j+=1
    tmp += maxScore[i]
    if tmp >= G:
        min_num = j
        break
#-最小-2個はスコアが高いものを入れてよし-#
cos_per.sort(key = lambda x:-x[1])
choice = set(range(1,D+1))
choiceList = []
for i in range(0,min_num-3):
    choiceList+=score[cos_per[i][0]-1]
    choice.discard(cos_per[i][0])
    max_num -=1
 
#-足し上げる-#

ans = float('inf')
for ch in itertools.permutations(choice,max_num):
    tmp = []
    for ci in ch:
        tmp+=score[ci-1]
    times = 0
    total = 0
    for sc in tmp:
        total += sc
        times += 1
        if total >= G:
            ans = min(ans,times)
            break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    D, G = read_values()
    P = [0] * D
    C = [0] * D
    for i in range(D):
        P[i], C[i] = read_values()
        
    dp = [0] * (sum(P) + 1)
    for i in range(2 ** D):
        A = [0 if (i >> k) & 1 else P[k] - 1 for k in range(D)]
        r = sum(P[k] if (i >> k) & 1 else 0 for k in range(D))
        t = sum(C[k] + P[k] * (k + 1) * 100 if (i >> k) & 1 else 0 for k in range(D))
        dp[r] = max(dp[r], t)
        for j in range(D - 1, - 1, -1):
            for k in range(1, A[j] + 1):
                r += 1
                t += (j + 1) * 100
                dp[r] = max(dp[r], t)
    for i in range(len(dp) - 1):
        dp[i + 1] = max(dp[i +1], dp[i])
    # print(dp)
    print(bisect.bisect_right(dp, G) - 1)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys,math,collections,itertools,copy
input = sys.stdin.readline

D,G=list(map(int,input().split()))
score = []
maxScore = []
cos_per = []
for d in range(D):
    p,c=map(int,input().split())
    tmp = [(d+1)*100]*p
    tmp[-1]+=c
    score.append(tmp)
    maxScore.append(sum(tmp))
    cos_per.append([d+1,sum(tmp)/p])
    cos_per.append([d+1,d+1])
#-最大いくつの問題セットを必要とするか-#
maxScore.sort()
tmp = 0
for idx,mS in enumerate(maxScore):
    tmp += mS
    if tmp >= G:
        max_num = idx+1
        break
#-最小でいくつの問題セットを必要とするか-#
tmp = 0
j=0
for i in range(len(maxScore)-1,-1,-1):
    j+=1
    tmp += maxScore[i]
    if tmp >= G:
        min_num = j
        break
#-最小-2個はスコアが高いものを入れてよし-#
cos_per.sort(key = lambda x:-x[1])
choice = set(range(1,D+1))
choiceList = []
for i in range(0,min_num-3):
    choiceList+=score[cos_per[i][0]-1]
    choice.discard(cos_per[i][0])
    max_num -=1
 
#-足し上げる-#

ans = float('inf')
for ch in itertools.permutations(choice,max_num):
    tmp = []
    for ci in ch:
        tmp+=score[ci-1]
    times = 0
    total = 0
    for sc in tmp:
        total += sc
        times += 1
        if total >= G:
            ans = min(ans,times)
            break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys,math,collections,itertools,copy
input = sys.stdin.readline

D,G=list(map(int,input().split()))
score = []
maxScore = []
cos_per = []
for d in range(D):
    p,c=map(int,input().split())
    tmp = [(d+1)*100]*p
    tmp[-1]+=c
    score.append(tmp)
    maxScore.append(sum(tmp))
    #cos_per.append([d+1,sum(tmp)/p])
    cos_per.append([d+1,d+1])
#-最大いくつの問題セットを必要とするか-#
maxScore.sort()
tmp = 0
for idx,mS in enumerate(maxScore):
    tmp += mS
    if tmp >= G:
        max_num = idx+1
        break
#-最小でいくつの問題セットを必要とするか-#
tmp = 0
j=0
for i in range(len(maxScore)-1,-1,-1):
    j+=1
    tmp += maxScore[i]
    if tmp >= G:
        min_num = j
        break
#-最小-2個はスコアが高いものを入れてよし-#
cos_per.sort(key = lambda x:-x[1])
choice = set(range(1,D+1))
choiceList = []
for i in range(0,min_num-2):
    choiceList+=score[cos_per[i][0]-1]
    choice.discard(cos_per[i][0])
    max_num -=1
 
#-足し上げる-#

ans = float('inf')
for ch in itertools.permutations(choice,max_num):
    tmp = []
    for ci in ch:
        tmp+=score[ci-1]
    times = 0
    total = 0
    for sc in tmp:
        total += sc
        times += 1
        if total >= G:
            ans = min(ans,times)
            break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys,math,collections,itertools,copy
input = sys.stdin.readline

D,G=list(map(int,input().split()))
score = []
maxScore = []
cos_per = []
for d in range(D):
    p,c=map(int,input().split())
    tmp = [(d+1)*100]*p
    tmp[-1]+=c
    score.append(tmp)
    maxScore.append(sum(tmp))
    cos_per.append([d+1,sum(tmp)])
#-最大いくつの問題セットを必要とするか-#
maxScore.sort()
tmp = 0
for idx,mS in enumerate(maxScore):
    tmp += mS
    if tmp >= G:
        max_num = idx+1
        break
#-最小でいくつの問題セットを必要とするか-#
tmp = 0
j=0
for i in range(len(maxScore)-1,-1,-1):
    j+=1
    tmp += maxScore[i]
    if tmp >= G:
        min_num = j
        break
#-最小-2個はスコアが高いものを入れてよし-#
cos_per.sort(key = lambda x:-x[1])
choice = set(range(1,D+1))
choiceList = []
for i in range(0,min_num-2):
    choiceList+=score[cos_per[i][0]-1]
    choice.discard(cos_per[i][0])
    max_num -=1
 
#-足し上げる-#

ans = float('inf')
for ch in itertools.permutations(choice,max_num):
    tmp = []
    for ci in ch:
        tmp+=score[ci-1]
    times = 0
    total = 0
    for sc in tmp:
        total += sc
        times += 1
        if total >= G:
            ans = min(ans,times)
            break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys,math,collections,itertools,copy
input = sys.stdin.readline

D,G=list(map(int,input().split()))
score = []
maxScore = []
cos_per = []
for d in range(D):
    p,c=map(int,input().split())
    tmp = [(d+1)*100]*p
    tmp[-1]+=c
    score.append(tmp)
    maxScore.append(sum(tmp))
    cos_per.append([d+1,sum(tmp)/p])
#-最大いくつの問題セットを必要とするか-#
maxScore.sort()
tmp = 0
for idx,mS in enumerate(maxScore):
    tmp += mS
    if tmp >= G:
        max_num = idx+1
        break
#-最小でいくつの問題セットを必要とするか-#
tmp = 0
j=0
for i in range(len(maxScore)-1,-1,-1):
    j+=1
    tmp += maxScore[i]
    if tmp >= G:
        min_num = j
        break
#-最小-1個はコスパが高いものを入れてよし-#
cos_per.sort(key = lambda x:-x[1])
choice = set(range(1,D+1))
choiceList = []
for i in range(min_num-1):
    choiceList+=score[cos_per[i][0]-1]
    choice.discard(cos_per[i][0])
    max_num -=1
#-足し上げる-#
ans = float('inf')
for ch in itertools.permutations(choice,max_num):
    tmp = copy.deepcopy(choiceList)
    for ci in ch:
        tmp+=score[ci-1]
    times = 0
    total = 0
    for sc in tmp:
        total += sc
        times += 1
        if total >= G:
            ans = min(ans,times)
            break
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# スペース区切りの整数の入力
d, g = map(int, input().split())
#配列の入力
data = [list(map(int, input().split())) for _ in range(d)]
sn=1000

for i in range(2**d):
    ts = [False]*d
    score = 0
    tmp_sn = 0
    flg = True
    for j in range(d):
        if (i>>j)&1:
            ts[j] = True
            score += data[j][0]*100*(j+1)+data[j][1]
            tmp_sn += data[j][0]


    if score < g:
        for k in reversed(range(len(ts))):
            if  ts[k] == False:
                need = g - score
                s1 = (k+1) * 100
                nnum = need // s1
                if nnum < data[k][0]:
                    tmp_sn += nnum
                    break
                else:
                    flg = False
                    break

    if flg == True and sn > tmp_sn:
        sn = tmp_sn

print(sn)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
D, G = map(int, input().split())
data = [list(map(int, input().split())) for i in range(D)]
ps, cs = zip(*data)
clear_cnt = D
min_prb = 1000
for i in range(1 << D):
    result = 0
    num_prb = 0
    not_selected_list = list()
    for j in range(D):
        if (i >> j & 1):
            result += ps[j] * 100 * (j+1) + cs[j]
            num_prb += ps[j]
        else:
            not_selected_list.append(j)
    if result < G:
        not_selected = max(not_selected_list)
        add_num_prb = min(ps[not_selected], (G - result)/(100*(not_selected+1)))
        num_prb += add_num_prb
        result += add_num_prb * (not_selected+1) * 100
    if result >= G:
        min_prb = min(min_prb, num_prb)
print(int(min_prb))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
D, G = map(int, input().split())
data = [list(map(int, input().split())) for i in range(D)]
ps, cs = zip(*data)
clear_cnt = D
min_prb = 1000
for i in range(2 ** D):
    result = 0
    num_prb = 0
    not_selected = -1
    for j in range(D):
        if (i >> j & 1):
            result += ps[j] * 100 * (j+1) + cs[j]
            num_prb += ps[j]
        elif j>not_selected:
            not_selected = j
    if result >= G:
        if num_prb < min_prb:
            min_prb = num_prb
    elif result+ps[not_selected]*100*(not_selected+1) > G:
        add_num_prb = (G - result)/(100*(not_selected+1))
        num_prb += add_num_prb
        if num_prb < min_prb:
            min_prb = num_prb
print(min_prb)

Submission status: Wrong Answer

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

ans = float('inf')

for i in range(1 << d):
  count = 0
  sum = 0
  nokori = set(range(1, d+1))
  
  for j in range(d):
    if i & (1<<j):
      sum += pc[j][0] * (j+1) * 100 + pc[j][1]
      count += pc[j][0]
      nokori.discard(j+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 = list(map(int,input().split()))
pc = []
for i in range(D):
    pc.append(list(map(int,input().split())))

scoreList = [0 for i in range(D)]

for i in range(D):
    scoreList[i] = (i + 1) * 100 * pc[i][0] + pc[i][1]

choiceList = [[] for i in range(2 ** D)]
for i in range(2 ** D):
    for j in range(D):
        choiceList[i].append(i // (2 ** j) % 2)

minCount = 10 ** 8
for choice in choiceList:
    score = 0
    count = 0
    for i in range(len(choice)):
        if choice[i] == 1:
            score += scoreList[i]
            count += pc[i][0]
    for j in range(D):
        countTmp = count
        extraScore = (j + 1) * 100 * pc[j][0]
        delta = G - score
        if delta < 0 or choice[j] == 1:
            countTmp = 10 ** 8
        elif delta == 0:
            countTmp = count
        elif delta > 0:
            if delta <= extraScore:
                countTmp += delta // ((j + 1) * 100)
                if delta % ((j + 1) * 100) > 0:
                    countTmp += 1
            else:
                countTmp = 10 ** 8
        if countTmp < minCount:
            minCount = countTmp
print(minCount)

Submission status: Wrong Answer

Solution code:
import math

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
    rest = list(range(1, D+1))

    for i in range(D):
        if bit & (1 << i):
            sum += (i + 1) * pc[i][0] * 100 + pc[i][1]
            count += pc[i][0]
            rest.remove(i + 1)

    if sum < G:
        max_num = max(rest)
        n = min(pc[max_num - 1][0], math.ceil((G - sum) // (max_num * 100)))
        count += n
        sum += n * max_num * 100

    if sum >= G:
        ans = min(ans, count)

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 bit in range(1 << D):
    count = 0
    sum = 0
    rest = set(range(1, D+1))

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

    if sum < G:
        max_num = max(rest)
        n = min(pc[max_num - 1][0], (G - sum) // (max_num * 100))
        count += n
        sum += n * max_num * 100

    if sum >= G:
        ans = min(ans, count)

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 bit in range(1 << D):
    count = 0
    sum = 0
    rest = list(range(1, D+1))

    for i in range(D):
        if bit & (1 << i):
            sum += (i + 1) * pc[i][0] * 100 + pc[i][1]
            count += pc[i][0]
            rest.remove(i+1)

    if sum < G:
        max_num = max(rest)
        n = min(pc[max_num - 1][0], -((G - sum) // (max_num * 100)))
        count += n
        sum += n * max_num * 100

    if sum >= G:
        ans = min(ans, count)

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 bit in range(1 << D):
    count = 0
    sum = 0
    rest = list(range(1, D+1))

    for i in range(D):
        if bit & (1 << i):
            sum += 100 * (i + 1) * pc[i][0] + pc[i][1]
            count += pc[i][0]
            rest.remove(i+1)

    if sum < G:
        max_num = max(rest)
        n = min(pc[max_num - 1][0], (G - sum) // (max_num * 100))
        count += n
        sum += n * max_num * 100

    if sum >= G:
        ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
p = [0]*D
c = [0]*D
count0 = float("inf")
total0 = 0

for a in range(D):
    p[a], c[a] = map(int, input().split())
    total0 = (a+1)*p[a]*100+c[a]
    if total0 >=G:
        count0 = min(count0, p[a])

count1 = 0
total1 = 0

for i in reversed(p):
    for j in range(1, i+1):
        if total1 < G:
            count1 += 1
            total1 += (p.index(i)+1)*100
    total1 += c[p.index(i)]

print(min(count0, count1))

Submission status: Wrong Answer

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

#0:ボーナスを使わない、1:ボーナスを使う
res = 100000

for i in range(2**D):
  q = 0
  rem = G
  nob = []
  for j in range(D):
    if ((i >> j) & 1):
      q += PC[j][0]
      rem -= PC[j][0]*100*(j+1)+PC[j][1]
      if q>res:
        break
    else:
      nob.append(j)
  nob.sort(reverse = True)
  for j in nob:
    if rem<=0:
      break
    po = 100*(j+1)
    if rem <= (PC[j][0]-1)*po:
      q += (rem+po-1)//po
      break
    else:
      rem -= (PC[j][0]-1)*po
      q += PC[j][0]-1
  else:
    continue
  res = min(res,q)
  
print(res)

Submission status: Wrong Answer

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

#0:ボーナスを使わない、1:ボーナスを使う
res = 100000

for i in range(2**D):
  q = 0
  rem = G
  nob = []
  for j in range(D):
    if ((i >> j) & 1):
      q += PC[j][0]
      rem -= PC[j][0]*100*(j+1)+PC[j][1]
      if q>res:
        break
    else:
      nob.append(j)
  nob.sort(reverse = True)
  for j in nob:
    if rem<=0:
      break
    po = 100*(j+1)
    if rem <= PC[j][0]*po:
      q += (rem+po-1)//po
      break
    else:
      rem -= (PC[j][0]-1)*po
      q += PC[j][0]-1
  else:
    continue
  res = min(res,q)
  
print(res)

Submission status: Wrong Answer

Solution code:
import math 
D, G = map(int, input().split())
K = [list(map(int, input().split())) for _ in range(D)]
G //= 100
def settify(i):
  s = []
  t = []
  for j in range(D):
    if i % 2 == 0:
      t.append(j)
    else:
      s.append(j)
    i = i>>1
    
  return s,t

ans = 10**20  
for i in range(2**D):
  s, t = settify(i)
  pt = sum([K[j][0]*(j+1)+K[j][1]//100 for j in s])
  tmp = sum([K[j][0] for j in s])
  #print(pt, G)
  #print(t)
  while pt < G and t:
    #print(min(K[t[-1]][0]-1,math.ceil((G-pt)/(t[-1]+1))),t[-1])
    tmp += min(K[t[-1]][0]-1,math.ceil((G-pt)/(t[-1]+1)))
    pt += min(K[t[-1]][0]-1,math.ceil((G-pt)/(t[-1]+1)))*(t[-1]+1)
    t.pop()
  #print(tmp,s)  
  ans = min(ans, tmp)
    
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P = [list(map(int, input().split())) for d in range(D)]
ans = 1000

for i in range(1 << D):
    s = 0
    n = 0
    for j in range(D):
        if i >> j & 1 == 1:
            s += 100 * (j + 1) * P[j][0] + P[j][1]
            n += P[j][0]
    for j in range(D - 1, 0, -1):
        if i >> j & 1 == 0:
            r = (G - s) // 100 // (j +1)
            if r > P[j][0]:
                n = 1000
            else:
                n += max(r, 0)
            break
    ans = min(ans, n)

print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P = [list(map(int, input().split())) for d in range(D)]
ans = 1000

for i in range(1 << D):
    s = 0
    n = 0
    for j in range(D):
        if i >> j & 1 == 1:
            s += 100 * (j + 1) * P[j][0] + P[j][1]
            n += P[j][0]
    for j in range(D - 1, -1, -1):
        if i >> j & 1 == 0:
            r = (G - s) // 100
            if r > P[j][0]:
                n = 1000
            else:
                n += max(r, 0)
            break
    ans = min(ans, n)

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import math
d,g=map(int,input().split())
x=[list(map(int,input().split())) for i in range(d)]
y=[]
z=[x[i][0]-1 for i in range(d)]
z.reverse()
zz=[]
ans=10**10

pin=0
for i in range(d):
  pin+=100
  y.append(x[i][0]*pin+x[i][1])
  zz+=[pin]

zz.reverse()

for lst in itertools.product(range(2),repeat=d):
  sum=0
  cnt=0
  for i in range(d):
    if lst[i]==1:
      cnt+=x[i][0]
      sum+=y[i]
  if sum>=g:
      ans=min(ans,cnt)
  else:
    lack=g-sum
    for j in range(d):
      if lst[-j-1]==0:  
        if z[j]*zz[j]>lack:
            cnt+=math.ceil(lack/zz[j])
            break
        else:
            cnt+=z[j]
            lack-=z[j]*zz[j]
    ans=min(ans,cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import math
d,g=map(int,input().split())
x=[list(map(int,input().split())) for i in range(d)]
y=[]
z=[x[i][0]-1 for i in range(d)]
z.reverse()
zz=[]
ans=10**10

pin=0
for i in range(d):
  pin+=100
  y.append(x[i][0]*pin+x[i][1])
  zz+=[pin]

zz.reverse()

for lst in itertools.product(range(2),repeat=d):
  sum=0
  cnt=0
  for i in range(d):
    if lst[i]==1:
      cnt+=x[i][0]
      sum+=y[i]
  if sum>=g:
      ans=min(ans,cnt)
  else:
    lack=g-sum
    for j in range(d):
      if lst[-j-1]==0:  
        if z[j]*zz[j]>=lack:
            cnt+=math.ceil(lack/zz[j])
            break
        else:
            cnt+=z[j]
            lack-=z[j]*zz[j]
    ans=min(ans,cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import math
d,g=map(int,input().split())
x=[list(map(int,input().split())) for i in range(d)]
y=[]
z=[x[i][0]-1 for i in range(d)]
z.reverse()
zz=[]
ans=10**10

pin=0
for i in range(d):
  pin+=100
  y.append(x[i][0]*pin+x[i][1])
  zz+=[pin]

zz.reverse()

for lst in itertools.product(range(2),repeat=d):
  sum=0
  cnt=0
  for i in range(d):
    if lst[i]==1:
      cnt+=x[i][0]
      sum+=y[i]
  if sum>=g:
      ans=min(ans,cnt)
  else:
    lack=g-sum
    for j in range(d):
      if lst[-j]==0:  
        if z[j]*zz[j]>=lack:
            cnt+=math.ceil(lack/zz[j])
            break
        else:
            cnt+=z[j]
            lack-=z[j]*zz[j]
    ans=min(ans,cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import math
d,g=map(int,input().split())
x=[list(map(int,input().split())) for i in range(d)]
y=[]
z=[x[i][0]-1 for i in range(d)]
z.reverse()
zz=[]
ans=10**10

pin=0
for i in range(d):
  pin+=100
  y.append(x[i][0]*pin+x[i][1])
  zz+=[pin]

zz.reverse()

for lst in itertools.product(range(2),repeat=d):
  sum=0
  cnt=0
  for i in range(d):
    if lst[i]==1:
      cnt+=x[i][0]
      sum+=y[i]
  if sum>=g:
      ans=min(ans,cnt)
  else:
    lack=g-sum
    for j in range(d):
      if lst[-d]==0:  
        if z[j]*zz[j]>=lack:
            cnt+=math.ceil(lack/zz[j])
            break
        else:
            cnt+=z[j]
            lack-=z[j]*zz[j]
    ans=min(ans,cnt)

print(ans)