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 = map(int, input().split())
scores = [list(map(int, input().split())) for i in range(d)]
pod = []

for i in range(2 ** d):
    # sep = [0] * n
    # nums = []
    cnt = 0
    point = 0
    for j in range(d):
        if (i >> j) & 1:
            point += 100 * (j + 1) * scores[j][0]
            point += scores[j][1]
            cnt += scores[j][0]
    if point >= g:
        pod.append(cnt)
        continue
    else:
        for p in range(d - 1, -1, -1):
            if not (i >> p) & 1:
                for q in range(1, scores[p][0]):
                    if point < g:
                        point += (p + 1) * 100
                        cnt += 1
    pod.append(cnt)

print(min(pod))

Submission status: Wrong Answer

Solution code:
'''
最小となる問題数のケースは2通り。
1. 得点の大きい問題から順に解いていく
2. コンプリートボーナスの大きい問題から解いていく
どちらのケースでも解いた問題の組み合わせは以下となる
(a)コンプリートボーナスを獲得した問題 * n + (b)一部だけ解いている問題
'''

D, G = map(int, input().split())

# (Pi, Pi個の問題を説いた場合のボーナスポイント込の得点, 1問あたりの得点)
PC = [0] * D
for i in range(D):
    P, C = map(int, input().split())
    PC[i] = [P, 100 * (i + 1) * P + C, 100 * (i + 1)]

# print(PC)

# 各問題で全問解くか解かないかをbit全探索
ans = 10 * 100
for i in range(2 ** D):
    bit = format(i, '0' + str(D) + 'b') # 完答有無
    score = 0 # 得点
    solve = 0

    # print("==========bit: " + bit + " =============")

    # 完答分の得点
    for j in range(D):
        if bit[j] == "1":
            score += PC[j][1]
            solve += PC[j][0]
            # print(j, score, solve)

    # 完答分の得点で足りない場合、解かれていない問題の得点(1つのみ選び、完答しない)で足りるか
    if score < G:
        for k in range(D):
            # print("-(k+1): " + str(-(k+1)), "bit[-(k+1)]: " + str(bit[-(k+1)]))
            if bit[-(k+1)] == "0":
                sol = min((G - score) // PC[-(k+1)][2], PC[-(k+1)][0] - 1) # 解いた数
                score += PC[-(k+1)][2] * sol
                solve += sol
                # print(sol, score, solve)
                break

    # 総合スコアがG以上となる場合、問題数が最小であれば答えを更新する
    if score >= G:
        ans = min(ans, solve)
    # print(bit, score, solve, ans)

print(ans)

Submission status: Wrong Answer

Solution code:
'''
最小となる問題数のケースは2通り。
1. 得点の大きい問題から順に解いていく
2. コンプリートボーナスの大きい問題から解いていく
どちらのケースでも解いた問題の組み合わせは以下となる
(a)コンプリートボーナスを獲得した問題 * n + (b)一部だけ解いている問題
'''

D, G = map(int, input().split())

# (Pi, Pi個の問題を説いた場合の特典)
PC = [0] * D
for i in range(D):
    P, C = map(int, input().split())
    PC[i] = [P, 100 * (i + 1) * P + C, 100 * (i + 1)]

# print(PC)

# 各問題で全問解くか解かないかをbit全探索
ans = 10 * 100
for i in range(D ** 2):
    bit = format(i, '0' + str(D) + 'b') # 完答有無
    score = 0 # 得点
    solve = 0

    # print("==========bit: " + bit + " =============")

    # 完答分の得点
    for j in range(D):
        if bit[j] == "1":
            score += PC[j][1]
            solve += PC[j][0]
            # print(j, score, solve)

    # 完答分の得点で足りない場合、解かれていない問題の得点(1つのみ選び、完答しない)で足りるか
    if score < G:
        for k in range(D):
            # print("-(k+1): " + str(-(k+1)), "bit[-(k+1)]: " + str(bit[-(k+1)]))
            if bit[-(k+1)] == "0":
                sol = min((G - score) // PC[-(k+1)][2], PC[-(k+1)][0] - 1) # 解いた数
                score += PC[-(k+1)][2] * sol
                solve += sol
                # print(sol, score, solve)
                break

    # 総合スコアがG以上となる場合、問題数が最小であれば答えを更新する
    if score >= G:
        ans = min(ans, solve)
    # print(bit, score, solve, 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)]
ans=0
for i in range(1<<d):
  p=0
  cnt=0
  for j in range(d):
    if (i>>j)&1:
      p+=100*(j+1)*pc[j][0]+pc[j][1]
      cnt+=pc[j][0]
  if g>p:
    for k in range(d)[::-1]:
      if (i>>k)&1==0:
        if g-p<=100*(k+1)*(pc[k][0]-1):
          cnt+=(g-p)//(100*(k+1))
          break
        else:
          cnt=10**5
          break
  if ans==0 or ans>cnt:
    ans=cnt
print(ans)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for _ in range(d)]
ans=10**16
for i in range(1<<d):
  p=0
  cnt=0
  for j in range(d):
    if (i>>j)&1:
      p+=100*(j+1)*pc[j][0]+pc[j][1]
      cnt+=pc[j][0]
  if g>p:
    for k in range(d)[::-1]:
      if (i>>k)&1==0:
        if g-p<=100*(k+1)*(pc[k][0]-1):
          cnt+=(g-p)//(100*(k+1))
          break
        else:
          cnt=10**5
          break
  ans=min(ans,cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
[d,g]=list(map(int,input().split()))
pc=[]
for i in range(d):
    kari=list(map(int,input().split()))
    pc.append(kari)
gokei=[]
for i in range(d):
    gokei.append(100*(i+1)*pc[i][0]+pc[i][1])

kosumin=10000
for i in range(1<<d):
    score=0
    kosu=0
    jmax=0
    siyouzumi=[]
    for j in range(d):
        if ((i>>j)&1)==1:
            score+=gokei[j]
            kosu+=pc[j][0]
            siyouzumi.append(j)

    if score>=g:
        if kosumin>kosu:
            kosumin=kosu
    if score<g:
        a=d-1
        while True:
            if a==-1:
                break
            if not a in siyouzumi:
                saidai=a
                break
            a-=1
        if a==-1:
            continue

        for k in range(pc[saidai][0]):
            score+=(saidai+1)*100
            kosu+=1
            if k==pc[saidai][0]-1:
                score+=pc[saidai][1]
            if score>=g:
                break
        if kosumin>kosu:
            kosumin=kosu
print(kosumin)

Submission status: Wrong Answer

Solution code:
abcd=list(input())
for i in range(2**3):
    if i//4==0:
        op1="+"
    else:
        op1="-"
    i=i%4
    if i//2==0:
        op2="+"
    else:
        op2="-"
    i=i%2
    if i==0:
        op3="+"
    else:
        op3="-"
    siki=abcd[0]+op1+abcd[1]+op2+abcd[2]+op3+abcd[3]
    if eval(siki)==7:
        siki+="=7"
        break
print(siki)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
D,G=map(int,input().split(" "))
Comp={}
for i in range(D):
  p,c=map(int,input().split(" "))
  Comp[i]=[p,c]
Min=1000000000
for i in range(2**(D)):
  answer=0
  score=0
  Clear=[]
  for j in range(D):
    if ((i>>j)&1):
      score+=(j+1)*100*Comp[j][0]
      score+=Comp[j][1]
      answer+=Comp[j][0]
      Clear.append(j+1)
  No=D
  Count=0
  while score<G:
    if No in Clear or Count==Comp[D-1][0]:
      Count=0
      No-=1
    if No<1:
      break
    score+=100*No
    Count+=1
    answer+=1
  if score>=G:
    Min=min(Min,answer)
print(Min)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
D,G=map(int,input().split(" "))
Problem=[]
Comp={}
n=0
for i in range(D):
  p,c=map(int,input().split(" "))
  n+=p
  [Problem.append(100*(i+1)) for _ in range(p)]
  Comp[i]=[p,c]
Min=1000000000
for i in range(2**(D)):
  answer=0
  score=0
  Clear=[]
  for j in range(n):
    if ((i>>j)&1):
      score+=(j+1)*100*Comp[j][0]
      score+=Comp[j][1]
      answer+=Comp[j][0]
      Clear.append(j+1)
  No=D
  Count=0
  while score<G:
    if No in Clear:
      Count=0
      No-=1
    else:
      score+=100*No
      Count+=1
      answer+=1
    if Count==Comp[D-1][0]:
      Count=0
      No-=1
    if No<0:
      break
  #print(Clear)
  #print(score)
  #print(answer)
  if score>=G:
    Min=min(Min,answer)
print(Min)

Submission status: Wrong Answer

Solution code:
#coding:utf-8
D,G=map(int,input().split(" "))
Problem=[]
Comp={}
n=0
for i in range(D):
  p,c=map(int,input().split(" "))
  n+=p
  [Problem.append(100*(i+1)) for _ in range(p)]
  Comp[i]=[p,c]
Min=1000000000
for i in range(2**(D)):
  answer=0
  score=0
  Clear=[]
  for j in range(n):
    if ((i>>j)&1):
      score+=(j+1)*100*Comp[j][0]
      score+=Comp[j][1]
      answer+=Comp[j][0]
      Clear.append(j)
  No=D
  Count=0
  while score<G:
    if No in Clear:
      Count=0
      No-=1
    else:
      score+=100*No
      Count+=1
      answer+=1
    if Count==Comp[D-1][0]:
      Count=0
      No-=1
    if No<0:
      break
  if score>=G:
    Min=min(Min,answer)
print(Min)

Submission status: Wrong Answer

Solution code:
import math
D=0
p=[]
c=[]

def max_index(a):
    tmp=-1
    for i in range(len(a)):
        if not a[i]:
            tmp=i
    return tmp

def calc(G,m,a,n):
    global D,p,c
    if n==D:
        #print(a,G,m,m)
        if G<0:
            return m
        else:
            tmp=max_index(a)
            if tmp==-1 or G-p[tmp]*(tmp+1)*100>0:
                return 9999
            return m+math.ceil(G/((tmp+1)*100))
    if G>0:
        t1=calc(G,m,a,n+1)
        a2=[a[i] for i in range(D)]
        a2[n]=True
        t2=calc(G-p[n]*(n+1)*100-c[n],m+p[n],a2,n+1)
        return min(t1,t2)
    else:
        return calc(G,m,a,n+1)

def main():
    global D,p,c
    D,G=map(int,input().split())
    for i in range(D):
        pt,ct=map(int,input().split())
        p.append(pt)
        c.append(ct)
    a=[False for i in range(D)]
    print(calc(G,0,a,0))

main()

Submission status: Wrong Answer

Solution code:
from itertools import product

D,G=map(int,input().split())
p,c=[],[]

for _ in range(D):
  pi,ci=map(int,input().split())
  p.append(pi)
  c.append(ci)
  
ans=10**4
  
for cpls in product(range(2),repeat=D):
  num=0#回答数
  tensu=0#各cplsの得点
  for i,v in enumerate(cpls,start=1):
    if v==1:
      tensu+=i*100*p[i-1]+c[i-1]
      num+=p[i-1]
  if tensu>=G:
    ans=min(ans,num)
    continue
  for i,v in reversed(list(enumerate(cpls,start=1))):
    if v==0:
      for j in range(1,p[i-1]):
        tensu+=100
        num+=1
        if tensu>=G:
          ans=min(ans,num)
          break
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product

D,G=map(int,input().split())
p,c=[],[]

for _ in range(D):
  pi,ci=map(int,input().split())
  p.append(pi)
  c.append(ci)
  
ans=10**4
  
for cpls in product(range(2),repeat=D):
  num=0#回答数
  tensu=0#各cplsの得点
  for i,v in enumerate(cpls,start=1):
    if v==1:
      tensu+=i*100*p[i-1]+c[i-1]
      num+=p[i-1]
  if tensu>=G:
    ans=min(ans,num)
    continue
  for i,v in reversed(list(enumerate(cpls,start=1))):
    if v==0:
      for j in range(1,p[i-1]):
        tensu+=j*100
        num+=1
        if tensu>=G:
          ans=min(ans,num)
          break
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product

D,G=map(int,input().split())
p,c=[],[]

for _ in range(D):
  pi,ci=map(int,input().split())
  p.append(pi)
  c.append(ci)
  
ans=10**4
  
for cpls in product(range(2),repeat=D):
  num=0#回答数
  tensu=0#各cplsの得点
  for i,v in enumerate(cpls,start=1):
    if v==1:
      tensu+=i*100*p[i-1]+c[i-1]
      num+=p[i-1]
  if tensu>=G:
    ans=min(ans,num)
    continue
  for i,v in reversed(list(enumerate(cpls,start=1))):
    if v==0:
      for j in range(1,p[i-1]):
        tensu+=j*100*p[i-1]
        num+=1
        if tensu>=G:
          ans=min(ans,num)
          break
print(ans)

Submission status: Wrong Answer

Solution code:
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())
ans=10e+9

for i in range(2**D):
    sum=0
    q=0
    for j in range(D):
        if(i>>j & 1):
            sum+=(j+1)*100*p[j]+c[j]
            q+=p[j]
        else:
            rest_max=j
    if(sum<G):
        r1=100*(rest_max+1)
        need=-(-(G-sum)//r1)
        if(need>=p[rest_max]-1):
            continue
        q+=need
        sum+=need*r1
    
    if(sum>=G):
        ans=min(ans,q)

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import math

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())
    
ans=10**7

for ite in itertools.product([0,1], repeat=D):
    temp=0
    tn=0
    for i in range(len(ite)):
        temp+=ite[i]*(c[i]+100*(i+1)*p[i])
        tn+=p[i]*ite[i]
    if temp>=G:
        ans=min(ans,tn)
    else:
        for i in range(len(ite)-1,-1,-1):
            if ite[i]==0:
                if math.ceil((G-temp)//((i+1)*100)) <=p[i]-1 :#その難易度の問題を1問残しで埋めて目標に届くなら:
                    ans=min(ans,tn+(G-temp)//((i+1)*100))
                else:
                    temp+=(i+1)*100*(p[i]-1)
                    tn+=p[i]-1
                    
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

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())
    
ans=10**7

for ite in itertools.product([0,1], repeat=D):
    temp=0
    tn=0
    for i in range(len(ite)):
        temp+=ite[i]*(c[i]+100*(i+1)*p[i])
        tn+=p[i]*ite[i]
    if temp>=G:
        ans=min(ans,tn)
    else:
        for i in range(len(ite)-1,-1,-1):
            if ite[i]==0:
                if (G-temp)//((i+1)*100) <=p[i]-1 :#その難易度の問題を1問残しで埋めて目標に届くなら:
                    ans=min(ans,tn+(G-temp)//((i+1)*100))
                else:
                    temp+=(i+1)*100*(p[i]-1)
                    tn+=p[i]-1
                    
print(ans)

Submission status: Wrong Answer

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

ans = []

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)] #回数も逆順に出しておく

for i in range(2**n):
    s = 0
    m = 0
    max = 0 #残りの中で最も得点の単位が大きいもの
    for j in range(n):
        if((i >> j) & 1):
            max += 1
            s += max_score[j]
            m += howmany[j]
    if(s >= g):
        ans.append(m)
    else:
        if(max < n):
            rest = g - s
            k = rest // score[max] #最も得点の単位の高い問題を何問解くか
            if(k < howmany[max]):
                m += k
                ans.append(m)

print(min(ans))

Submission status: Wrong Answer

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

ans = []

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)] #回数も逆順に出しておく

for i in range(2**n):
    s = 0
    m = 0
    max = 0 #残りの中で最も得点の単位が大きいもの
    for j in range(n):
        if((i >> j) & 1):
            max += 1
            s += max_score[j]
            m += howmany[j]
    if(s >= g):
        ans.append(m)
    else:
        if(max < n):
            print(m)
            rest = g - s
            k = rest // score[max] #最も得点の単位の高い問題を何問解くか
            if(k < howmany[max]):
                m += k
                ans.append(m)
        
print(ans)
print(min(ans))

Submission status: Wrong Answer

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

ans = []

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)] #回数も逆順に出しておく

for i in range(2**n):
    s = 0
    m = 0
    max = 0 #残りの中で最も得点の単位が大きいもの
    for j in range(n):
        if((i >> j) & 1):
            max += 1
            s += max_score[j]
            m += howmany[j]
    if(s >= g):
        ans.append(m)
    else:
        if(max < n):
            rest = g - s
            k = rest // score[max] #最も得点の単位の高い問題を何問解くか
            m += k
            if m != 0:
                ans.append(m)
        
print(min(ans))

Submission status: Wrong Answer

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

ans = []

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)] #回数も逆順に出しておく

for i in range(2**n):
    s = 0
    m = 0
    max = 0 #残りの中で最も得点の単位が大きいもの
    for j in range(n):
        if((i >> j) & 1):
            max += 1
            s += max_score[j]
            m += howmany[j]
    if(s >= g):
        ans.append(m)
    else:
        if(max < n):
            rest = g - s
            k = rest // score[max] #最も得点の単位の高い問題を何問解くか
            m += k
            ans.append(m)
        
print(min(ans))

Submission status: Wrong Answer

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

ans = []

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)] #回数も逆順に出しておく

for i in range(2**n):
    s = 0
    m = 0
    max = 0 #残りの中で最も得点の単位が大きいもの
    for j in range(n):
        if((i >> j) & 1):
            max += 1
            s += max_score[j]
            m += howmany[j]
    if(s >= g):
        ans.append(m)
    else:
        if(max < n):
            rest = g - s
            k = rest // howmany[max]
            m += k
            ans.append(m)
        
print(min(ans))

Submission status: Wrong Answer

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

P = list()
C = list()

for _ in range(d):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)

check = float('inf')
for i in range(2 ** d):
    ans = 0
    cnt = 0
    for j in range(d):
        # flagがたっていたら
        if (i >> j) & 1:
            ans += P[j] * (j + 1) * 100 + C[j]
            cnt += P[j]
            if ans >= g:
                check = min(check, cnt)
                break
        else:
            rest = j
    extra = P[rest] * (rest + 1) * 100
    if ans < g < (ans + extra):
        cnt += int(((g - ans) / ((rest + 1) * 100)))
        check = min(check, cnt)

print(check)

Submission status: Wrong Answer

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

P = list()
C = list()

for _ in range(d):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)

check = float('inf')
for i in range(2 ** d):
    ans = 0
    cnt = 0
    for j in range(d):
        # flagがたっていたら
        if (i >> j) & 1:
            ans += P[j] * (j + 1) * 100 + C[j]
            cnt += P[j]
            if ans >= g:
                check = min(check, cnt)
                break
        else:
            rest = j
    extra = P[rest] * (rest + 1) * 100
    if ans < g <= (ans + extra):
        cnt += int(((g - ans) / ((rest + 1) * 100)))
        check = min(check, cnt)

print(check)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
p = [0]*int(D)
c = [0]*int(D)
for i in range(D):
  p[i],c[i] = map(int,input().split())
ans = 1e9
for i in range(2**D):
  s = 0
  num = 0
  rest_max = -1
  for j in range(D):
    if (i>>j)&1:
      s += 100 * (j+1) * p[j] + c[j]
      num += p[j]
    else:
      rest_max = j
  if s<G:
    s1 = 100 * (rest_max + 1)
    need = (G - s + s1 - 1) / s1
    if need >= p[rest_max]:
      continue
    num += need
  ans = min(ans, num)
print(ans)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
p = [0]*int(D)
c = [0]*int(D)
for i in range(D):
  p[i],c[i] = map(int,input().split())
total = 0
for i in range(D):
  total += p[i] * (i+1) * 100 + c[i]
ans = sum(p)
j = 0
pi = p[j]
while total>=G:
  if pi==0 and j<(D-1):
    j += 1
    pi = p[j]
  if pi==p[j]:
    total -= c[j]
  total -= (j+1)*100
  pi -= 1
  ans -= 1
print(ans+1)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

D,G = map(int, input().split())
Q = []
for i in range(D):
    p,c = map(int, input().split())
    Q.append(tuple([p,c,100*(i+1)*p+c]))

ans = 1000
for i in range(1<<D):
    point = 0
    comp = 0
    l_index = -1
    for j in range(D):
        if (i>>j)&1:
            comp += Q[j][0]
            point += Q[j][2]
        else:
            l_index = j
    
    if point >= G:
        ans = min(ans,comp)
    else:
        if l_index >= 0:
            required = math.floor((G-point)/(100*(l_index+1)))
            if required < Q[l_index][0]:
                ans = min(ans, comp+required)

print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

D,G = map(int, input().split())
Q = []
for i in range(D):
    p,c = map(int, input().split())
    Q.append(tuple([p,c,100*(i+1)*p+c]))

ans = 1000
for i in range(1<<D):
    point = 0
    comp = 0
    for j in range(D):
        l_index = -1
        if i&(1<<j):
            comp += Q[j][0]
            point += Q[j][2]
        else:
            l_index = j
    
    if point >= G:
        ans = min(ans,comp)
    else:
        if l_index >= 0:
            required = math.floor((G-point)/(100*(l_index+1)))
            if required < Q[l_index][0]:
                ans = min(ans, comp+required)

print(ans)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

D,G = map(int, input().split())
Q = []
for i in range(D):
    p,c = map(int, input().split())
    Q.append(tuple([p,c,100*(i+1)*p+c]))

ans = 1000
for i in range(1<<D):
    point = 0
    comp = 0
    for j in range(D):
        if i&(1<<j):
            comp += Q[j][0]
            point += Q[j][2]
    
    if point >= G:
        ans = min(ans,comp)
    else:
        middle = 1000
        for j in range(D):
            if i&(1<<j)==0:
                required = math.floor((G-point)/(100*(j+1)))
                if required < Q[j][0]:
                    middle = min(middle,required)
        if middle < 1000:
            ans = min(ans,comp+middle)

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import *
from itertools import *
import copy
from heapq import *


D,G=map(int,input().split())
PC=[]
maxc=0
count=0
countkaisuu=0
for i in range(D):
    p,c=map(int,input().split())
    PC.append([p,c//100,i+1])
    maxc=max(c//100,maxc)
    count+=p*(i+1)
    count+=c//100
    countkaisuu+=p


G//=100
dplst=[[p for p,c,pi in PC] for i in range(count-G+1)]
dp=[countkaisuu+10000 for i in range(count-G+1)]
dp[0]=countkaisuu
for p,c,pi in PC:
    for i in range(len(dp)):
        if i-pi>=0:
            if p>dplst[i-pi][pi-1]>0 and dp[i]>=dp[i-pi]:
                dp[i]=dp[i-pi]-1
                dplst[i]=copy.copy(dplst[i-pi])
                dplst[i][pi-1]-=1
        if i-c-pi>=0:
            if dplst[i-c-pi][pi-1]==p and dp[i]>=dp[i-c-pi]:
                dp[i]=dp[i-c-pi]-1
                dplst[i]=copy.copy(dplst[i-c-pi])
                dplst[i][pi-1]-=1
dpmin=min(dp)

dplst=[[0 for i in range(D)] for i in range(G+maxc+10)]
dp=[100000 for i in range(G+maxc+10)]
dp[0]=0
for p,c,pi in PC:
    for i in range(len(dp)):
        if i-pi>=0:
            if dplst[i-pi][pi-1]<p-1 and dp[i]>dp[i-pi]:
                dp[i]=dp[i-pi]+1
                dplst[i]=copy.copy(dplst[i-pi])
                dplst[i][pi-1]+=1
        if i-c-pi>=0:
            if dplst[i-c-pi][pi-1]==p-1 and dp[i]>dp[i-c-pi]:
                dp[i]=dp[i-c-pi]+1
                dplst[i]=copy.copy(dplst[i-c-pi])
                dplst[i][pi-1]+=1

for p,c,pi in PC:
    for i in range(len(dp)-1,-1,-1):
        if i+pi<len(dp):
            if p>dplst[i+pi][pi-1]>0 and dp[i]-1>dp[i+pi]:
                dp[i]=dp[i+pi]-1
                dplst[i]=copy.copy(dplst[i+pi])
                dplst[i][pi-1]-=1
        if i+c+pi<len(dp):
            if dplst[i+c+pi][pi-1]==p and dp[i]-1>dp[i+c+pi]:
                dp[i]=dp[i+c+pi]-1
                dplst[i]=copy.copy(dplst[i+c+pi])
                dplst[i][pi-1]-=1


print(min(min(dp[G:]),dpmin))

Submission status: Wrong Answer

Solution code:
from collections import *
from itertools import *
import copy
from heapq import *


D,G=map(int,input().split())
PC=[]
maxc=0
for i in range(D):
    p,c=map(int,input().split())
    PC.append([p,c//100,i+1])
    maxc=max(c//100,maxc)
PC.reverse()
G//=100
dplst=[[0 for i in range(D)] for i in range(G+maxc+10)]
dp=[100000 for i in range(G+maxc+10)]
dp[0]=0
for p,c,pi in PC:
    for i in range(len(dp)):
        if i-pi>=0:
            if dplst[i-pi][pi-1]<p-1 and dp[i]>dp[i-pi]:
                dp[i]=dp[i-pi]+1
                dplst[i]=copy.copy(dplst[i-pi])
                dplst[i][pi-1]+=1
        if i-c-pi>=0:
            if dplst[i-c-pi][pi-1]==p-1 and dp[i]>dp[i-c-pi]:
                dp[i]=dp[i-c-pi]+1
                dplst[i]=copy.copy(dplst[i-c-pi])
                dplst[i][pi-1]+=1

for p,c,pi in PC:
    for i in range(len(dp)-1,-1,-1):
        if i+pi<len(dp):
            if p>dplst[i+pi][pi-1]>0 and dp[i]-1>dp[i+pi]:
                dp[i]=dp[i+pi]-1
                dplst[i]=copy.copy(dplst[i+pi])
                dplst[i][pi-1]-=1
        if i+c+pi<len(dp):
            if dplst[i+c+pi][pi-1]==p and dp[i]-1>dp[i+c+pi]:
                dp[i]=dp[i+c+pi]-1
                dplst[i]=copy.copy(dplst[i+c+pi])
                dplst[i][pi-1]-=1
#for a,(i,m) in enumerate(zip(dp,dplst)):
#    print(a,i,m)
print(min(dp[G:]))

Submission status: Wrong Answer

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

#print(plist)

bit = [0,1]
'''
(0, 0, 0, 0, 0)
(0, 0, 0, 0, 1)
(0, 0, 0, 1, 0)
(0, 0, 0, 1, 1)
(0, 0, 1, 0, 0)
(0, 0, 1, 0, 1)
(0, 0, 1, 1, 0)
(0, 0, 1, 1, 1)
(0, 1, 0, 0, 0)
(0, 1, 0, 0, 1)
(0, 1, 0, 1, 0)
(0, 1, 0, 1, 1)
(0, 1, 1, 0, 0)
(0, 1, 1, 0, 1)
(0, 1, 1, 1, 0)
(0, 1, 1, 1, 1)
(1, 0, 0, 0, 0)
(1, 0, 0, 0, 1)
(1, 0, 0, 1, 0)
(1, 0, 0, 1, 1)
(1, 0, 1, 0, 0)
(1, 0, 1, 0, 1)
(1, 0, 1, 1, 0)
(1, 0, 1, 1, 1)
(1, 1, 0, 0, 0)
(1, 1, 0, 0, 1)
(1, 1, 0, 1, 0)
(1, 1, 0, 1, 1)
(1, 1, 1, 0, 0)
(1, 1, 1, 0, 1)
(1, 1, 1, 1, 0)
(1, 1, 1, 1, 1)

'''
answerList = []
for i in range(D):
    answerList.append([plist[i][0], 100 * (i+1) * plist[i][0] + plist[i][1]])


solutionList = itertools.product(bit, repeat=D)
result = []
for i,solutionTupple in enumerate(itertools.product(bit, repeat=D)):
    if i == 0:
        continue
    tmp = [0,0]
    maxIndex = -1
    for i in range(D):
        if solutionTupple[i] == 1:
            tmp[0] += answerList[i][0]
            tmp[1] += answerList[i][1]
        if solutionTupple[i] == 0:
            maxIndex = max(maxIndex, i)

    result.append(tmp)
    #print(solutionTupple)

    if maxIndex == -1:
        break
    for i in range(answerList[maxIndex][0]):
        a = tmp[0] + i + 1
        b = tmp[1] + (i + 1) * (maxIndex+1) * 100
        result.append([a,b])
#print(answerList)
#print(result)
answer = float('inf')
for r in result:
    if r[1] >= G:
        answer = min(answer,r[0])

print(answer)

Submission status: Wrong Answer

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

#print(plist)

bit = [0,1]
'''
(0, 0, 0, 0, 0)
(0, 0, 0, 0, 1)
(0, 0, 0, 1, 0)
(0, 0, 0, 1, 1)
(0, 0, 1, 0, 0)
(0, 0, 1, 0, 1)
(0, 0, 1, 1, 0)
(0, 0, 1, 1, 1)
(0, 1, 0, 0, 0)
(0, 1, 0, 0, 1)
(0, 1, 0, 1, 0)
(0, 1, 0, 1, 1)
(0, 1, 1, 0, 0)
(0, 1, 1, 0, 1)
(0, 1, 1, 1, 0)
(0, 1, 1, 1, 1)
(1, 0, 0, 0, 0)
(1, 0, 0, 0, 1)
(1, 0, 0, 1, 0)
(1, 0, 0, 1, 1)
(1, 0, 1, 0, 0)
(1, 0, 1, 0, 1)
(1, 0, 1, 1, 0)
(1, 0, 1, 1, 1)
(1, 1, 0, 0, 0)
(1, 1, 0, 0, 1)
(1, 1, 0, 1, 0)
(1, 1, 0, 1, 1)
(1, 1, 1, 0, 0)
(1, 1, 1, 0, 1)
(1, 1, 1, 1, 0)
(1, 1, 1, 1, 1)

'''
answerList = []
for i in range(D):
    answerList.append([plist[i][0], 100* (i+1) + plist[i][1]])


solutionList = itertools.product(bit, repeat=D)
result = []
for solutionTupple in itertools.product(bit, repeat=D):
    tmp = [0,0]
    maxIndex = -1
    for i in range(D):
        if solutionTupple[i] == 1:
            tmp[0] += answerList[i][0]
            tmp[1] += answerList[i][1]
        if solutionTupple[i] == 0 :
            maxIndex = max(maxIndex,i)

    result.append(tmp)

    if maxIndex == -1:
        break
    for i in range(answerList[maxIndex][0]):
        a = tmp[0] + i + 1
        b = tmp[1] + (i + 1) * (i+1) * 100
        result.append([a,b])
answer = float('inf')
for r in result:
    if r[1] >= G:
        answer = min(answer,r[0])

print(answer)