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())
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
  if ind==0:
    continue
  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))

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
  if ind==0:
    continue
  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))

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

def pattern():
  pat = deque()
  temp = deque()
  for i in sorted(range(d),reverse=True):
    if pc[i][0]*(i+1) >= g:
      pat.append(i)
  
  for i in range(d):
    if i not in pat:
      if pc[i][0]*(i+1) + pc[i][1]//100 >= g:
        temp.append([i,pc[i][0]])
  temp = sorted(temp, reverse=False, key=lambda x: x[1])
  temp = [x[0] for x in temp]
  
  pat.extend(temp)
  for i in sorted(range(d),reverse=True):
    if i not in pat:
      pat.append(i)
  return pat

pat = pattern()
ans = sum([pc[x][0] for x in range(d)])

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

dfs(0, 0, 0, pat)
dfs(0,0,0,list(reversed(pat)))

print(ans)

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
  if ind==0:
    continue
  for j in range(D):
    if ind>>j & 1:
      s += (j+1)*100*li[j][0]+li[j][1]
      n+=li[j][0]
  if s < G:
    for j in range(D-1,-1,-1):
      if ind>>j & 0:
        tmp = s % ((j+1)*100)
        if tmp > 0:
          if tmp==li[j][1]:
            tmp -=1
          s += (j+1)*100*tmp
          n+= tmp
  if s >= G:
    if n<min_n:
      min_n=n

print(min_n)

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=0
n = 10**9
s=0
for ind in range(2**D):
  n=0
  if ind==0:
    continue
  for j in range(D):
    if ind>>j & 1:
      s += (j+1)*100*li[j][0]+li[j][1]
      n+=li[j][0]
  if s < G:
    for j in range(D-1,-1,-1):
      if ind>>j & 0:
        tmp = s % ((j+1)*100)
        if tmp > 0:
          if tmp==li[j][1]:
            tmp -=1
          s += (j+1)*100*tmp
          n+= tmp
  if s >= G:
    if n<min_n:
      min_n=n

print(min_n)

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 i in range(d):
  if pc[i][0]*(i+1) + pc[i][1]//100 >= g:
    pat.append(i)
for i in range(d):
  if i not in pat:
    pat.appendleft(i)

ans = sum([pc[x][0] for x in range(d)])

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

dfs(0, 0, 0, pat)

print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

minimam=float('INF')

digit = "0"+str(D)+"b"

for i in range(2**D):
  pattern = str(format(i,digit))
  #この完答パターンのときの完答に伴う問題数と得点を算出する
  point = 0
  count = 0
  for j in range(D):
    if pattern[j]=="1":
      count += pc[j][0]
      point += pc[j][0]*100*(j+1)+pc[j][1]
  #ポイントがGに未達の場合、残りの問題を解いてみて、Gに到達するか検証。
  #到達する場合でなおかつ問題数が最小であれば記録する。
  last0 = pattern.rfind("0")
  r = G -point
  if r > 0:
    if last0==-1:
      continue
    tmp = math.ceil(r/100*(last0+1))
    if tmp < pc[last0][0]:
      minimam = min(minimam,tmp+count)
  else:
    minimam = min(minimam,count)

print(minimam)

Submission status: Wrong Answer

Solution code:
D, G = [int(n) for n in input().split(' ')]

p = []
c = []
for _ in range(D):
    temp = [int(n) for n in input().split(' ')]
    p += [temp[0]]
    c += [temp[1]]

ans = 10**9
for flag in range(1<<D):
    score = 0
    cnt = 0
    
    for i in range(D):  # コンプリートボーナス
        if flag & 1<<i:
            score += c[i] + 100*(i+1)*p[i]
            cnt += p[i]
            
    if score > G:
        if cnt < ans:
            ans = cnt
    
    for i in range(D, 0, -1):
        if ~flag & 1<<(i-1):
            for n in range(0,p[i-1]):
                score += 100*(i)
                cnt += 1
                if cnt == 3:
                    pass
                if score >= G:
                    if cnt < ans:
                        ans = cnt
                        continue

print(ans)

Submission status: Wrong Answer

Solution code:
D, G = [int(n) for n in input().split(' ')]

p = []
c = []
for _ in range(D):
    temp = [int(n) for n in input().split(' ')]
    p += [temp[0]]
    c += [temp[1]]

ans = 10**9
for flag in range(1<<D):
    score = 0
    cnt = 0
    
    for i in range(D):  # コンプリートボーナス
        if flag & 1<<i:
            score += c[i] + 100*(i+1)*p[i]
            cnt += p[i]
            
    if score > G:
        if cnt < ans:
            ans = cnt
    
    for i in range(D, 0, -1):
        if ~flag & 1<<(i-1):
            for n in range(1,p[i-1]):
                score += 100*i
                cnt += 1
                if cnt == 3:
                    pass
                if score >= G:
                    if cnt < ans:
                        ans = cnt
                        continue

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

sum1 = 0
ans1 = 0
for i in range(d - 1, -1, -1):
    if g - sum1 < p[i] * 100 * (i + 1):
        ans1 += -(-(g - sum1) // (100 * (i + 1)))
        break
    else:
        sum1 += p[i] * 100 * (i + 1) + c[i]
        ans1 += p[i]
    if sum1 >= g:
        break
sum2 = 0
ans2 = 0
for i in range(d):
    if g - sum2 < p[i] * 100 * (i + 1):
        ans2 += -(-(g - sum2) // (100 * (i + 1)))
        break
    else:
        sum2 += p[i] * 100 * (i + 1) + c[i]
        ans2 += p[i]
    if sum2 >= g:
        break
print(min(ans1, ans2))

Submission status: Wrong Answer

Solution code:
def main():
    d, g = (int(x) for x in input().split())
    g //= 100
    p, c = [], []
    for i in range(d):
        a, b = (int(x) for x in input().split())
        b //= 100
        p.append(a)
        c.append(b)

    ans = 10**10

    for i in range(1 << d):
        cnt = 0
        total = 0
        for j in range(d):
            if (i & (1 << j)):
                cnt += p[j]
                total += (j+1)*p[j] + c[j]
        for j in range(d)[::-1]:
            if (i & (1 << j)):
                continue
            if (total >= g):
                break
            if (total + (j+1)*(p[j]-1) <= g):
                cnt += p[j] - 1
                total += (j+1)*(p[j]-1)
            else:
                cnt += (g-total+j) // (j+1)

        if (total >= g):
            ans = min(ans, cnt)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
d,g = map(int,input().split())
P, C = [], []
probs = set([i for i in range(d)])
for _ in range(d):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
res = float('inf')
for i in range(2**d):
    tmp = []
    score = 0
    cnt = 0
    for j in range(d):
        if ((i>>j)&1):
            tmp.append(j)
    for k in tmp:
        score += (k+1)*100*P[k] + C[k]
        cnt += P[k]    
    if score >= g:
        res = min(res, cnt)
    else:
        x = list(probs - set(tmp))
        x.sort(reverse=True)
        n = x[0]
        upp = math.ceil((g - score) / ((n+1)*100))
        res = min(res, cnt+upp)
print(res)

Submission status: Wrong Answer

Solution code:
import math

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

digit = '0'+str(D)+'b'
minimam = float("inf")

for i in range(2**D):
    pattern = list(str(format(i, digit)))
    point = 0
    count = 0
    tmp = -1
    for j in range(D):
        if pattern[j] == "1":
            p = pc[j][0]
            c = pc[j][1]
            point += p*100*(j+1)+c
            count += p
        else:
            tmp = j
    r = G - point
    if r > 0 and tmp > -1:
        countTmp = math.ceil(r/(100*(tmp+1)))
        count += countTmp
        # if countTmp < pc[tmp][0]:
        #     count += countTmp
        # else:
        #     continue
    minimam = min(count, minimam)

print(minimam)

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())))
a = []
for i in range(D):
    a.append((-li[i][0], (i+1)*100))
    a.append((li[i][0], li[i][1]/li[i][0] + (i+1)*100))
a.sort(reverse=True, key=lambda x: x[1])
U = sum([x[0] for x in li])
L = 0
while U-L> 1:
    x = (U+L)//2
    z = (U+L)//2
    cnt = 0
    used = []
    for y in a:
        if y[0] < 0 and not -y[0] in used:
            num = min(x, -y[0])
            cnt += num*y[1]
            x -= num
        elif y[0] > 0:
            if y[0] <= x:
                cnt += y[0]*y[1]
                x -= y[0]
                used.append(y[0])
        if x == 0:
            break
    if cnt >= G-1:
        U = z
    else:
        L = z
print(U)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
num=[0 for _ in range(d)]
com=[0 for _ in range(d)]
hum=[100*(i+1) for i in range(d)]
ans=10**9+7
for i in range(d):
    num[i],com[i]=map(int,input().split())
for i in range(2**d):
    tmp_get=0
    tmp_ans=0
    for j in range(d):
        if((i>>j)&1):
            tmp_get+=num[-j-1]*hum[-j-1]
            tmp_get+=com[-j-1]
            tmp_ans+=num[-j-1]
    for j in range(d):
        if not((i>>j)&1):
            tmp_cnt=min(-(-(g-tmp_get)//hum[-j-1]),num[-j-1])
            tmp_ans+=tmp_cnt
            tmp_get+=tmp_cnt*hum[-j-1]
            if tmp_cnt==num[-j-1]:
                tmp_get+=com[-j-1]
        if tmp_get>g:
            break
    ans=min(ans,tmp_ans)
print(ans)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
num=[0 for _ in range(d)]
com=[0 for _ in range(d)]
hum=[100*(i+1) for i in range(d)]
ans=10**9+7
for i in range(d):
    num[i],com[i]=map(int,input().split())
for i in range(2++d):
    tmp_get=0
    tmp_ans=0
    for j in range(d):
        if((i>>j)&1):
            tmp_get+=num[-j-1]*hum[-j-1]
            tmp_get+=com[-j-1]
            tmp_ans+=num[-j-1]
    for j in range(d):
        if not((i>>j)&1):
            tmp_cnt=min(-(-(g-tmp_get)//hum[-j-1]),num[-j-1])
            tmp_ans+=tmp_cnt
            tmp_get+=tmp_cnt*hum[-j-1]
            if tmp_cnt==num[-j-1]:
                tmp_get+=com[-j-1]
        if tmp_get>g:
            break
    ans=min(ans,tmp_ans)
print(ans)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
num=[0 for _ in range(d)]
com=[0 for _ in range(d)]
ans=10**9+7
for i in range(d):
    num[i],com[i]=map(int,input().split())
for i in range(2++d):
    tmp_get=0
    tmp_ans=0
    for j in range(d):
        if((i>>j)&1):
            tmp_get+=(num[-j-1]*(100*(d-j)))
            tmp_get+=com[-j-1]
            tmp_ans+=num[-j-1]
    for j in range(d):
        if not((i>>j)&1):
            tmp_cnt=min(-(-(g-tmp_get)//(100*(d-j))),num[-j-1])
            tmp_ans+=tmp_cnt
            tmp_get+=tmp_cnt*(100*(d-j))
            if tmp_cnt==num[-j-1]:
                tmp_get+=com[-j-1]
        if tmp_get>g:
            break
    ans=min(ans,tmp_ans)
print(ans)

Submission status: Wrong Answer

Solution code:
#n進数への変換関数の定義
#Python 3.7とかではデフォであるが，Python 3.4.3(AtCoder仕様)ではまだない
########10進法からn進法への変換関数部分##############
def format(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
############################

########10進法からn進法への変換関数(m桁埋める)部分##############
def format0(X, n, m):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    if len(out) < m:
        out = "0" * (m - len(out)) + out
    return out
############################
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(d)]
ans=1000

for i in range(pow(2,d)):
  pt=0
  ans_=0
  t = format0(i,2,d)
  for j in range(d):
    if t[j]=="1":
      pt += (j+1)*100*pc[j][0]+pc[j][1]
      ans_ += pc[j][0]
  if pt >= g:
    ans = min(ans,ans_)
    continue
  for j in range(d):
    j=d-1-j
    if t[j]=="1":
      continue
    if pt + ((j+1)*100*pc[j][0]-1)>=g:
      q=(j+1)*100
      k = (g-pt+q-1)//q
      ans_ += k
      break
    else:
      pt += (j+1)*100*pc[j][0]-1
      ans_ += pc[j][0]-1
  ans = min(ans,ans_)
print(ans)

Submission status: Wrong Answer

Solution code:
def dfs(i, sum, cnt, memo):
    if i == d + 1:
        if sum >= g:
            tmp.append(cnt)
        else:
            cnt += min(p_lst[max(memo) - 1], -(-(g - sum) // (max(memo) * 100)))
            if sum + min(p_lst[max(memo) - 1], (g - sum) // (max(memo) * 100)) * max(memo) * 100 >= g:
                tmp.append(cnt)
        
    else:
        dfs(i + 1, sum + 100 * i * p_lst[i - 1] + c_lst[i - 1], cnt + p_lst[i - 1], memo)
        dfs(i + 1, sum, cnt, memo + [i])

d, g = map(int, input().split())
p_lst = []
c_lst = []
tmp = []
for i in range(d):
    p, c = map(int, input().split())
    p_lst.append(p)
    c_lst.append(c)


dfs(1, 0, 0, [])
print(min(tmp))

Submission status: Wrong Answer

Solution code:
def dfs(i, sum, cnt, memo):
    if i == d + 1:
        if sum >= g:
            tmp.append(cnt)
        else:
            cnt += min(p_lst[max(memo) - 1], (g - sum) // (max(memo) * 100))
            if sum + min(p_lst[max(memo) - 1], (g - sum) // (max(memo) * 100)) * max(memo) * 100 >= g:
                tmp.append(cnt)
        
    else:
        dfs(i + 1, sum + 100 * i * p_lst[i - 1] + c_lst[i - 1], cnt + p_lst[i - 1], memo)
        dfs(i + 1, sum, cnt, memo + [i])

d, g = map(int, input().split())
p_lst = []
c_lst = []
tmp = []
for i in range(d):
    p, c = map(int, input().split())
    p_lst.append(p)
    c_lst.append(c)


dfs(1, 0, 0, [])
print(min(tmp))

Submission status: Wrong Answer

Solution code:
# なぜかうまくいかない
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

D, G = MAP()
pc = [LIST() for i in range(D)]

B = list(product([0, 1], repeat=D))

ans = INF
for b in B:
    point = 0
    count = 0
    for i, vonus in enumerate(b):
        if vonus == 1:
            # take all with vonus
            point += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
        # print(count)
    if point >= G:
        ans = min(count, ans)
        # print(count)
    else:
        # 後ろから
        need_point = G - point
        added_count = count
        for i in range(len(b)-1, -1, -1):
            if b[i] == 0:
                while need_point > 0:
                    count_max = pc[i][0]
                    point_max = count_max * (100 * (i + 1))
                    if need_point - point_max >= 0:
                        need_point -= point_max
                        count += count_max
                    else:
                        count += ceil(need_point / (100 * (i + 1)))
                        need_point -= point_max
        ans = min(ans, count)
print(ans)

Submission status: Wrong Answer

Solution code:
n,k = [int(i) for i in input().split()]
pg = []
for i in range(n):
  array = list(map(int,input().split()))
  pg.append(array)
l = []

for i in range(n):
  line = [int(j)*100*(i+1) for j in range(pg[i][0])]
  line.append(pg[i][0]*100*(i+1)+pg[i][1])
  l.append(line)

chk =[]
def f(a,b,c):
  if a == n:
    chk.append([b,c])
  else:
    return [f(a+1,b+l[a][i],c+i) for i in range(len(l[a]))]
f(0,0,0)
chk.sort()
for i in chk:
  if i[0] >= k:
    print(i[1])
    break

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P, comp = [], []
r = 10**10
for i in range(D):
  p, c = map(int, input().split())
  P.append(p), comp.append(100 * (i+1) * p + c)
for i in range(1<<D):
  _g, _r = 0, 0
  for j in range(D):
    if i>>j & 1:
      _g += comp[j]
      _r += P[j]
  if _g >= G:
    r = min(r, _r)
    continue
  for j in range(D-1, -1, -1):
    if i>>j & 1:
      continue
    x = int((G - _g) // (100 * (j+1)))
    if x <= P[j]:
      _r += x
      r = min(r, _r)
      break
print(r)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P, comp = [], []
r = 10**10
for i in range(D):
  p, c = map(int, input().split())
  P.append(p), comp.append(100 * (i+1) * p + c)
for i in range(1<<D):
  _g, _r = 0, 0
  for j in range(D):
    if i>>j & 1:
      _g += comp[j]
      _r += P[j]
  if _g >= G:
    r = min(r, _r)
    continue
  for j in range(D-1, -1, -1):
    if i>>j & 1:
      continue
    x = int((G - _g) // (100 * (j+1))) + (G - _g) % (100 * (j+1))
    if x <= P[j]:
      _r += x
      r = min(r, _r)
    break
print(r)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P, comp = [], []
r = 10**10
for i in range(D):
  p, c = map(int, input().split())
  P.append(p), comp.append(100 * (i+1) * p + c)
for i in range(1<<D):
  _g, _r = 0, 0
  for j in range(D):
    if i>>j & 1:
      _g += comp[j]
      _r += P[j]
    if _g >= G:
      r = min(r, _r)
  if _g >= G:
    continue
  for j in range(D-1, -1, -1):
    if i>>j & 1:
      continue
    _r += int((G - _g) // (100 * (j+1))) + (G - _g) % (100 * (j+1))
    r = min(r, _r)
    break
print(r)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P, comp = [], []
r = 10**10
for i in range(D):
  p, c = map(int, input().split())
  P.append(p), comp.append(100 * (i+1) * p + c)
for i in range(1<<D):
  _g, _r = 0, 0
  for j in range(D):
    if i>>j & 1:
      _g += comp[j]
      _r += P[j]
    if _g >= G:
      print(bin(i), _g, _r) ###
      r = min(r, _r)
  if _g >= G:
    continue
  for j in range(D-1, -1, -1):
    if i>>j & 1:
      continue
    _r += int((G - _g) // (100 * (j+1))) + (G - _g) % (100 * (j+1))
    r = min(r, _r)
    break
print(r)

Submission status: Wrong Answer

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*(P-1) >= g: return 1
    elif point+100*(now+1)*P + C[now] >= g: return 2
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now) == 1:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    elif flag(point,P[now],now) == 2:
        n += P[now]
    else:
        if now == -1:
            for i in remain:
                score(point, n, i, remain)
        elif m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

Submission status: Wrong Answer

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        for i in range(1,P[now]+1):
            point += 100*(now+1)
            n += 1
            if point >= g:
                if m > n:
                    m = n
                    break
    else:
        if now == -1:
            for i in remain:
                score(point, n, i, remain)
        elif m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

Submission status: Wrong Answer

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P > g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in remain:
                score(point, n, i, remain)
        elif m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

Submission status: Wrong Answer

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*(P-1) >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in remain:
                score(point, n, i, remain)
        elif m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

Submission status: Wrong Answer

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in remain:
                score(point, n, i, remain)
        # elif m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

Submission status: Wrong Answer

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    remain = remain[:]
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in remain:
                score(point, n, i, remain)
        elif m <= n+P[now]: return
        else:
            # remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

Submission status: Wrong Answer

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[now],now):
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in remain:
                score(point, n, i, remain)
        elif m <= n+P[now]: return
        else:
            nxtp = point + P[now]*100*(now+1) + C[now]
            remain = remain[:]
            remain.remove(now)
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)

Submission status: Wrong Answer

Solution code:
import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

def flag(point,P,now):
    if point+100*(now+1)*P >= g: return 1
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    temp = max(remain)
    if m <= n: return
    elif point >= g: m = n
    elif flag(point,P[temp],temp):
        n += math.ceil((g-point)/(100*(temp+1)))
        if m > n: m = n
    else:
        if now == -1:
            for i in remain:
                score(point, n, i, remain)
        elif m <= n+P[now]: return
        else:
            nxtp = point + P[now]*100*(now+1) + C[now]
            remain = remain[:]
            remain.remove(now)
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)