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:
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, done=[]):
    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:
        done.append(now)
        done = list(done)
        if now == -1:
            for i in range(d):
                score(point, n, i, done)
        elif m <= n+P[now]: return
        else:
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done)

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, done=[]):
    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)))
        m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, i, done[:])
        elif m <= n+P[now]: return
        else:
            for i in range(d):
                if not i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done[:])

score()
print(m)

Submission status: Wrong Answer

Solution code:
import copy
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)
 
m = 10**9
def score(point = 0, n = 0, now=0, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        donecp = copy.copy(done)
        donecp.append(now)
        for i in range(d):
            if not i in done:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done)
 
for i in range(d):
    done = []
    score(0,0,i,done)
print(m)

Submission status: Wrong Answer

Solution code:
import copy
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)
 
m = 10**9
def score(point = 0, n = 0, now=0, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        done.append(now)
        done = copy.copy(done)
        for i in range(d):
            if not i in done:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done)
 
for i in range(d):
    done = []
    score(0,0,i,done)
print(m)

Submission status: Wrong Answer

Solution code:
import copy
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)
 
m = 10**9
def score(done, point=0, n=0, now=0):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done.add(now)
        donecp = done.copy()
        for i in range(d):
            if not i in donecp:
                score(donecp, point+P[now]*100*(now+1) + C[now], n + P[now], i)
 
for i in range(d):
    done = set()
    score(done,0,0,i)
print(m)

Submission status: Wrong Answer

Solution code:
import copy
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)
 
m = 10**9
def score(point, n, now, done):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done.add(now)
        done = done.copy()
        for i in range(d):
            if not i in done:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done)
 
for i in range(d):
    done = set([])
    score(0,0,i,done)
print(m)

Submission status: Wrong Answer

Solution code:
import copy
N,G=map(int,input().split())
pc=[]
for i in range(N):
  pc.append(list(map(int,input().split())))
ans=10**10
for i in range(2**N):
  tmp=0
  tmp2=0
  l=[]
  for j in range(N):
    if i>>j&1:
      w=pc[j]
      p,c=w[0],w[1]
      tmp+=100*(j+1)*p+c
      tmp2+=p
    else:
      l.append(j)
  if tmp>=G:
    ans=min(ans,tmp2)
  else:
    pc_=copy.copy(pc)
    while tmp<G:
      index=l.pop(-1)
      w=pc_.pop(index)
      p,c=w[0],w[1]
      if 100*(index+1)*p+c+tmp<G:
        tmp+=(100*(index+1)*p+c)
        tmp2+=p
      elif 100*(index+1)*p+tmp<G<=100*(index+1)*p+c+tmp:
        tmp=G
        tmp2+=p
      else:
        tmp2+=(G-tmp)//(100*(index+1))
        tmp=G
    ans=min(ans,tmp2)
print(ans)

Submission status: Wrong Answer

Solution code:
import copy
import math
 
d,g = map(int,input().split())
P = []
C = []
for i in range(d):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
 
m = 10**9
def score(point = 0, n = 0, now=0, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        done.append(now)
        for i in range(d):
            if i in done:
                continue
            else:
                done = copy.copy(done)
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done)
 
for i in range(d):
    done = []
    score(0,0,i,done)
print(m)

Submission status: Wrong Answer

Solution code:
import copy
import math

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

m = 10**9
def score(point = 0, n = 0, now=0, done=[]):
    global m
    if point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: 
            m = n
    else:
        done.append(now)
        for i in range(d):
            if i in done:
                continue
            else:
                done = copy.copy(done)
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, done)

for i in range(d):
    done = []
    score(0,0,i,done)
print(m)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
P = [0] * D
C = [0] * D
ans = list()
for i in range(D):
    P[i],C[i] = map(int,input().split())          
for i in range(2**D):
    use_list = list()
    score = 0
    n = 0
    for j in range(D):
        if (i>>j)&1:
            score += P[j]*100*(j+1) + C[j]
            use_list.append(j)
            n += P[j]
    if score >= G:
        ans.append(n)
    else:
        for i in range(D):
            if not (D-1)-i in use_list:
                for j in range(P[(D-1)-i]):
                    score += P[(D-1)-i]*100*(D-i)*j
                    n += P[(D-1)-i]
                    if score >= G:
                        ans.append(n)
                        break
            else:
                continue
            break
print(min(ans))

Submission status: Wrong Answer

Solution code:
import time
import copy

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

# start = time.time()

m = 10**9
maxp = d-1

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

def score(point = 0, n = 0, now=0, done=[]):
    global m
    donecp = copy.deepcopy(done)
    if point >= g:
        if m > n: m = n
    else:
        if 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
        donecp.append(now)
        for i in range(d):
            if not i in donecp:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, donecp)

for i in range(d):
    done = []
    score(0,0,i,done)

# elapsed_time = time.time() - start

print(m)

Submission status: Wrong Answer

Solution code:
import time
import copy

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

# start = time.time()

m = 10**9
maxp = d-1
def score(point = 0, n = 0, now=0, done=[]):
    global m
    donecp = copy.deepcopy(done)
    if point >= g:
        if m > n: m = n
    elif point + 100*(now+1)*(P[now]-1) >= g:
        pointcp = point
        ncp = n
        for i in range(1,P[now]+1):
            pointcp += 100*(now+1)
            ncp += 1
            if pointcp >= g:
                if m > ncp:
                    m = ncp
                    break
    else:
        donecp.append(now)
        for i in range(d):
            if not i in donecp:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, donecp)

for i in range(d):
    done = []
    score(0,0,i,done)

# elapsed_time = time.time() - start

print(m)

Submission status: Wrong Answer

Solution code:
import time
import copy

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

# start = time.time()

m = 10**9
maxp = d-1
def score(point = 0, n = 0, now=0, done=[]):
    global m
    donecp = copy.deepcopy(done)
    if point >= g:
        if m > n: m = n
    elif point + 100*(now+1)*(P[now]-1) > g:
        pointcp = point
        ncp = n
        for i in range(1,P[now]+1):
            pointcp += 100*(now+1)
            ncp += 1
            if pointcp >= g:
                if m > ncp:
                    m = ncp
                    break
    else:
        donecp.append(now)
        for i in range(d):
            if not i in donecp:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, donecp)

for i in range(d):
    done = []
    score(0,0,i,done)

# elapsed_time = time.time() - start

print(m)

Submission status: Wrong Answer

Solution code:
import time
import copy

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

start = time.time()

m = 10**9
maxp = d-1
def score(point = 0, n = 0, now=0, done=[]):
    global m
    donecp = copy.deepcopy(done)
    if point >= g:
        if m > n: m = n
    elif point + 100*(now+1)*P[now] > g:
        pointcp = point
        ncp = n
        for i in range(1,P[now]+1):
            pointcp += 100*(now+1)
            ncp += 1
            if pointcp >= g:
                if m > ncp:
                    m = ncp
                    break
    else:
        donecp.append(now)
        for i in range(d):
            if not i in donecp:
                score(point+P[now]*100*(now+1) + C[now], n + P[now], i, donecp)

for i in range(d):
    done = []
    score(0,0,i,done)

elapsed_time = time.time() - start

print(m)

Submission status: Wrong Answer

Solution code:

from itertools import combinations

def read_input():
    d, g = map(int, input().split())

    points = []
    for i in range(d):
        points.append(tuple(map(int, input().split())))

    return d, g, points


def extract(x, lst):
    # xを2進数でlen(lst)桁に変換する
    bin_x = bin(x)[2:]
    bin_x = '0'* (len(lst) - len(bin_x)) + bin_x

    return [l for l, b in zip(lst, bin_x) if b == '1']


def submit():
    d, g, points = read_input()
    points = [(i*100, p, c) for i, (p, c) in enumerate(points, start=1)]

    # 1だけの場合を処理
    if len(points) == 1:
        t = points[0]
        if g > t[0] * t[1]:
            # ボーナス込みで達成するはず
            print(t[1])
        else:
            if g % t[0]:
                print(g // t[0] + 1)
            else:
                print(g // t[0])
        return

    min_count = float('inf')
    for fp in points:
        # fpを除き、完全に解く問題セットを選ぶ

        rest_points = points.copy()
        rest_points.remove(fp)
        for i in range(2 ** len(rest_points)):
            # コンプする問題を抽出
            comps = extract(i, rest_points)
            solved = 0
            get_points = 0
            for c in comps:
                solved += c[1]
                get_points += c[0] * c[1] + c[2]

            if g > get_points:
                rest = g - get_points
                if rest > fp[0] * fp[1]:
                    # fpだけではgは満たせないので失敗
                    continue
                else:
                    if rest % fp[0]:
                        solved += rest // fp[0] + 1
                    else:
                        solved += rest // fp[0]
            
            if min_count > solved:
                min_count = solved

    print(min_count)


if __name__ == "__main__":
    submit()

Submission status: Wrong Answer

Solution code:

from itertools import combinations

def read_input():
    d, g = map(int, input().split())

    points = []
    for i in range(d):
        points.append(tuple(map(int, input().split())))

    return d, g, points


def extract(x, lst):
    # xを2進数でlen(lst)桁に変換する
    bin_x = bin(x)[2:]
    bin_x = '0'* (len(lst) - len(bin_x)) + bin_x

    return [l for l, b in zip(lst, bin_x) if b == '1']


def submit():
    d, g, points = read_input()
    points = [(i*100, p, c) for i, (p, c) in enumerate(points, start=1)]

    min_count = float('inf')
    for fp in points:
        # fpを除き、完全に解く問題セットを選ぶ

        rest_points = points.copy()
        rest_points.remove(fp)
        for i in range(2 ** len(rest_points)):
            # コンプする問題を抽出
            comps = extract(i, rest_points)
            solved = 0
            get_points = 0
            for c in comps:
                solved += c[1]
                get_points += c[0] * c[1] + c[2]

            if g > get_points:
                rest = g - get_points
                if rest > fp[0] * fp[1]:
                    # fpだけではgは満たせないので失敗
                    continue
                else:
                    if rest % fp[0]:
                        solved += rest // fp[0] + 1
                    else:
                        solved += rest // fp[0]
            
            if min_count > solved:
                min_count = solved

    print(min_count)


if __name__ == "__main__":
    submit()

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(2 ** d):
    count = 0
    sum = 0
    nokori = set(range(1, d + 1))
    
    for j in range(d):
        if ((i >> j) & 1):
            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 = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]
ans = float('Inf')
for i in range(2 ** d):
    count = 0
    sum = 0
    nokori = set(range(1, d + 1))
    
    for j in range(d):
        if ((i >> j) & 1):
            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 = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]
ans = float('Inf')

for i in range(2 ** d):
    count = 0
    sum = 0
    nokori = set(range(1, d + 1))
    
    for j in range(d):
        if ((i >> j) & 1):
            sum += pc[j][0] * (i + 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 = map(int,input().split())
p = [0] * d
c = [0] * d
for i in range(d):
    p[i],c[i] = map(int,input().split())
#
s = [0] * (2**d)
n = [0] * (2**d)
for j in range(2**d):
    for k in range(d):
        if 1 & (j>>k):
            s[j] += 100*(d - k)*p[d - k - 1] + c[d - k - 1]
            n[j] += p[d - k - 1]
    for l in range(0,max(p)):
        if s[j] < g:
            s[j] += 100 * ((str(format(j,'b').zfill(d))).rfind('0') + 1)
            n[j] += 1
        else:
            break

#
ans = min(n)
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
G //= 100
A = [[] for i in range(D)]
S = 0
MP = 0
for i in range(D):
  p, c = map(int, input().split())
  L = [(i + 1) * j for j in range(p + 1)]
  L[p] += c//100
  A[i] = L[:]
  S += L[p]
  MP += p
L1 = [[0 for i in range(MP + 1)] for j in range(D)]
for i in range(D):
  for j in range(len(A[i])):
    for k in range(MP+1):
      if j + k <= MP:
        L1[i][j+k] = L1[i-1][k] + A[i][j]
L2 = [max(L1[i][j] for i in range(D)) for j in range(MP+1)]
i = 0
while L2[i] < G:
  i += 1
print(i)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
A = [[] for i in range(D)]
J = [0 for i in range(D)]
dif = [0 for i in range(D)]
S = 0
for i in range(D):
  p, c = map(int, input().split())
  L = [100 * (i + 1) * j for j in range(p + 1)]
  L[p] += c
  A[i] = L[:]
  S += L[p]
  J[i] = p
  dif[i] = L[p] - L[p-1]
while S > G:
  m = min(dif)
  S -= m
  for i in range(D):
    if dif[i] == m and J[i] != 0:
      if J[i] > 1:
        J[i] -= 1
        dif[i] = A[i][J[i]] - A[i][J[i]-1]
        break
      elif J[i] == 1:
        J[i] -= 1
        dif[i] = int(1e+9)
        break
print(sum(J))

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)

ans = 1e9
for mask in range(2**D - 1):
  score = 0
  num = 0
  rest_max = -1

  for i in range(D):
    if (mask >> i) & 1:
      score += 100 * (i+1) * P[i] + C[i]
      num += P[i]
    else:
      rest_max = i

  #print('mask {}, score {}, num {}, rest_max {}'.format(format(mask, '010b'), score, num, rest_max))

  if score < G:
    scr1 = 100 * (rest_max + 1)
    need = (G - score + scr1 - 1) // scr1
    if need >= P[rest_max]:
      #print('fault')
      continue
    num += need
    #print('追加 {}, 合計 {}'.format(need, num))
  #else:
    #print('合計 {}'.format(num))

  ans = min(ans, num)

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 19 13:18:23 2020

@author: morihiranaoki
"""

D, G = map(int,input().split())
pc = [list(map(int, input().split())) for i in range(D)]
score = [100*i for i in range(D)]

def reverse(depth, limit, stack, all_stack):
    if depth == limit + 1:
        return stack, all_stack

    for i in range(2):
        stack.append(i)
        reverse(depth+1, limit, stack, all_stack)[0]
        if len(stack) == limit:
            all_stack.append(list(stack))
            print(stack)
        del stack[-1]
    return stack, all_stack

Each_Full = [[pc[i][0], pc[i][0]*100*(i+1) + pc[i][1]] for i in range(D)]
_, AllStack = reverse(1, D, [], [])

chosen_Scores = [sum([Each_Full[i][1] for i in range(D) if AllStack[j][i] == 1]) for j in range(len(AllStack))]
chosen_Costs = [sum([Each_Full[i][0] for i in range(D) if AllStack[j][i] == 1]) for j in range(len(AllStack))]

for j in range(len(AllStack)):
    if chosen_Scores[j] >= G:
        continue
    else:
        kari = 0
        for i,factor in enumerate(AllStack[j]):
            if factor == 0:
                kari = i
        for i in range(pc[kari][0]):
            chosen_Scores[j] += (kari+1)*100
            chosen_Costs[j] += 1
            if chosen_Scores[j] >= G:
                break
        else:
            chosen_Costs[j] = 99999

print(min(chosen_Costs))

Submission status: Wrong Answer

Solution code:
import numpy as np
from functools import reduce
from operator import add,sub,mul,truediv
from fractions import gcd

d,g = map(int,input().split())

p = []
c = []

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


ans = 1000000000

for bit in range(1 << d):
    score = 0
    num = 0
    x = []
    for i in range(d):
        if (bit >>i)&1 == 0:
            x.append(i+1)
        else:
#            print(i)
#            print(p[i])
            score  = score + p[i]*(i+1)*100+c[i]
            num = num + p[i]
    
#    print(bin(bit))
#    print(x[::-1])

    flag = False
    for j in x[::-1]:
        for _ in range(p[j-1]):
            score  = score + j*100
            num = num +1
#            print(score)
#            print(num)
            if score >= g:
                flag = True
                break
        
#        print(num)
        if flag :
            break
        
#    print(score)
#    print(num)
#    print("num:{}".format(num))
    ans= min(ans,num)
#    print("$$$$$$$$$$$$$$$$$$$$$")

print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import combinations
import sys

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

q = []
for i in range(d):
    for j in range(p[i]):
        q.append((i + 1) * 100)

maxnum = sum(p)

for num in range(1, maxnum): #num問解く
    a = list(combinations(q, num))
    a = list(set(a))
    '''
    for i in range(len(a)):
        a[i] = list(a[i])
    '''
    #print(a)
    for i in range(len(a)):
        point = 0
        bonus = [0 for _ in range(d)]
        for j in range(len(a[i])):
            point += a[i][j]
            bonus[a[i][j] // 100 - 1] += 1
        for j in range(d):
            if bonus[j] == p[j]:
                point += c[j]
        #print(a[i], bonus, point)
        if point >= g:
            print(num)
            sys.exit()

Submission status: Wrong Answer

Solution code:
import itertools
import sys
input = sys.stdin.readline

def main():
    D, G = map(int, input().split())
    spc_list = [[(i+1) * 100] + [int(v) for v in input().split()] for i in range(D)]
    max_scores = [spc[0] * spc[1] + spc[2] for spc in spc_list]
    min_q = float("inf")
    for q_list in itertools.permutations(list(range(D))):
        score = 0
        q_num = 0
        for q_idx in q_list:
            if score + max_scores[q_idx] < G:
                score += max_scores[q_idx]
                q_num += spc_list[q_idx][1]
            else:
                q_num += min(round((G-score) / spc_list[q_idx][0]), spc_list[q_idx][1])
                score = G
                """
                for _ in range(spc_list[q_idx][1]):
                    score += spc_list[q_idx][0]
                    q_num += 1
                    if score >= G:
                        break
                score += spc_list[q_idx][2]
"""
            if score >= G:
                break
        if q_num < min_q:
            min_q = q_num
    print(min_q)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

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

ans = 10000000

for i in range(2**d):
    cnt = 0
    score = 0
    max_flg = 0
    for j in range(d):
        #print(str(i) + ' ' + str(j))
        if((i>>j)&1 == 1):
            score += pc[j][0]*(j+1)*100+pc[j][1]
            cnt += pc[j][0]
        else:
            max_flg = j
    
    print(str(score) + ' '+ str(cnt))
    if(score >= g):
        ans = min(ans,cnt)
    elif(score + (pc[max_flg][0]-1)*(max_flg+1)*100 < g):
        continue
    else:
        for k in range(pc[max_flg][0]):
            if(score + k*(max_flg+1)*100 >= g):
                ans = min(ans,cnt+k)
            else:
                continue

print(str(ans))

Submission status: Wrong Answer

Solution code:
import math

D, G = list(map(int, input().split()))
p = []
c = []
for i in range(D):
    pi, ci = list(map(int, input().split()))
    p.append(pi)
    c.append(ci)

count = 0

while G > 0:
    t = []
    for i in range(D):
        if p[i] > 0:
            if G < 100 * (i + 1) * p[i]:
                t.append(100 * (i + 1))
            else:
                t.append(min(G, 100 * (i + 1) * p[i] + c[i]) / p[i])
        else:
            t.append(0)
    best = t.index(sorted(t)[-1])
    if t[best] * p[best] < G:
        G -= t[best] * p[best]
        count += p[best]
        p[best] = 0
        c[best] = 0
    else:
        if G < 100 * (best + 1) * p[best]:
            count += math.ceil(G / (100*(best+1)))
        else:
            count += p[best]
        break

print(count)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
f = lambda:map(int,input().split())
d,g = f()
g//=100
ll = []
for i in range(d):
  p,c = f()
  ll.append([i+1,p,c//100])
ll = ll[::-1]
import itertools as it
ans = 10**9
for t in it.product(range(2),repeat=d):
  cnt = 0
  tot = 0
  flg = 1
  lg = [1,0]
  for i,b in enumerate(t):
    u,p,c = ll[i]
    if b:
      cnt += p
      tot += u*p+c
    elif flg:
      lg = [u,p]
      flg = 0
  if g <= tot+lg[0]*lg[1]:
    ans=min(ans,cnt+max(g-tot,1)//lg[0])
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
f = lambda:map(int,input().split())
d,g = f()
g//=100
ll = []
for i in range(d):
  p,c = f()
  ll.append([i+1,p,c//100])
ll = ll[::-1]
import itertools as it
ans = 10**9
for t in it.product(range(2),repeat=d):
  cnt = 0
  tot = 0
  flg = 1
  lg = [1,0,0]
  for i,b in enumerate(t):
    u,p,c = ll[i]
    if b:
      cnt += p
      tot += u*p+c
    elif flg:
      lg = ll[i]
      flg = 0
  if g < tot+lg[0]*lg[1]+lg[2]:
    ans=min(ans,cnt+max(g-tot,0)//lg[0])
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
f = lambda:map(int,input().split())
d,g = f()
g//=100
ll = []
for i in range(d):
  p,c = f()
  ll.append([i+1,p,c//100])
ll = ll[::-1]
import itertools as it
ans = 10**5
for t in it.product(range(2),repeat=d):
  cnt = 0
  tot = 0
  flg = 1
  lg = [1,0]
  for i,b in enumerate(t):
    u,p,c = ll[i]
    if b:
      cnt += p
      tot += u*p+c
    elif flg:
      lg = [u,p]
      flg = 0
  if g <= tot+lg[0]*lg[1]:
    ans=min(ans,cnt+max(g-tot,0)//lg[0])
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
f = lambda:map(int,input().split())
d,g = f()
g//=100
ll = []
for i in range(d):
  p,c = f()
  ll.append([i+1,p,c//100])
ll = ll[::-1]
import itertools as it
ans = 10**9
for t in it.product(range(2),repeat=d):
  cnt = 0
  tot = 0
  flg = 1
  lg = [1,0]
  for i,b in enumerate(t):
    u,p,c = ll[i]
    if b:
      cnt += p
      tot += u*p+c
    elif flg:
      lg = [u,p]
      flg = 0
  if g <= tot+lg[0]*lg[1]:
    ans=min(ans,cnt+max(g-tot,0)//lg[0])
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
f = lambda:map(int,input().split())
d,g = f()
g//=100
ll = []
for i in range(d):
  p,c = f()
  ll.append([i+1,p,c//100])
ll = ll[::-1]
import itertools as it
ans = 10**9
for t in it.product(range(2),repeat=d):
  cnt = 0
  tot = 0
  flg = 1
  lg = [1,0]
  for i,b in enumerate(t):
    u,p,c = ll[i]
    if b:
      cnt += p
      tot += u*p+c
    elif flg:
      lg = [u,p]
      flg = 0
  if g < tot+lg[0]*lg[1]:
    ans=min(ans,cnt+max(g-tot,0)//lg[0])
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
f = lambda:map(int,input().split())
d,g = f()
g//=100
ll = []
for i in range(d):
  p,c = f()
  ll.append([i+1,p,c//100])
ll = ll[::-1]
import itertools as it
ans = 10**9
for t in it.product(range(2),repeat=d):
  cnt = 0
  tot = 0
  flg = 1
  lg = [1,0]
  for i,b in enumerate(t):
    u,p,c = ll[i]
    if b:
      cnt += p
      tot += u*p+c
    elif flg:
      lg = [u,p]
      flg = 0
  if g > tot+lg[0]*lg[1]: continue
  else:
    ans=min(ans,cnt+max(g-tot,0)//lg[0])
print(ans)