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 as m
D,G = map(int,input().split())
L = []
for i in range(1,D+1):
    p,c = map(int,input().split())
    L.append([100*i + c/p, i, p, c])
goal = G
count = 0
# 見かけの点数でソート
L.sort()
# 見かけの点数が大きい順から問題を解いていく
# i番目を全問解いた見かけのiscoreについて　
# goal - iscore >= 0 ならば i番目を解くことは確定
for i in range(D-1,-1,-1):
    iscore = 100 * L[i][1] * L[i][2] + L[i][3]
    if goal - iscore >= 0:
        goal -= iscore
        count += L[i][2]
        if goal == 0:
            break
# goal - iscore < 0 ならば　
# i番目をj問解いたscore_jが goal - score_j <= 0 となるような 最小のjをメモ
# まだ解いていない他の問題についても同様にjをメモ(存在しない場合もあり)　これらのうち最小のjを採用する
    elif goal - iscore < 0:
        adopt = 100
        for k in range(i,-1,-1):
            score = 100 * L[k][1] * L[k][2] + L[k][3]
            if goal - score <= 0:
                j = min(m.ceil(goal/(100 * L[k][1])),L[k][2])
                if j < adopt:
                    adopt = j
        count += adopt
        break
print(count)

Submission status: Wrong Answer

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

res = float("inf")
for bit in range(1 << D):
    ans = 0
    num = 0
    for i in range(D):
        if ((bit >> i) & 1):
            ans += (i + 1) * 100 * PC[i][0] + PC[i][1]
            num += PC[i][0]
    if ans >= G:
        res = min(res, num)
    for i in range(D - 1, -1, -1):
        if ((bit >> i) & 1):
            continue
        for j in range(PC[i][0] - 1):
            ans += (i + 1) * 100
            num += 1
        if ans >= G:
            res = min(res, num)
            break
print(res)

Submission status: Wrong Answer

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

res = float("inf")
for bit in range(1 << D):
    sum = 0
    num = 0
    for i in range(D):
        if ((bit >> i) & 1):
            sum += (i + 1) * 100 * PC[i][0] + PC[i][1]
            num += PC[i][0]
    if sum >= G:
        res = min(res, num)
    for i in range(D - 1, -1, -1):
        if ((bit >> i) & 1):
            continue
        for j in range(PC[i][0] - 1):
            sum += (i + 1) * 100
            num += 1
        if sum >= G:
            res = min(res, num)
            break
print(res)

Submission status: Wrong Answer

Solution code:
import numpy as np

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)

cnt = np.zeros(D,dtype=int)
P = np.array(P)
C = np.array(C)

ans = sum(P)
cnt_tar = 0

ind_list = np.arange(D)

for bit_seed in range(2**D):

    s_bit = (format(bit_seed, '#016b'))[::-1]
    bit_list = np.array(list(s_bit[:D]),dtype=int)

    cnt = P*bit_list
    num_base = np.sum(cnt)

    point_base_array = (P * (ind_list+1) * 100 + C) * bit_list
    point_base = np.sum(point_base_array)
#    print(point_base_array)

    if point_base >= G:
        num = num_base
        ans = min(ans,num)
    elif num_base > ans:
        continue
    else:
        for i,bit in enumerate(bit_list):
            if bit == 0:
                tar = i

        point_max = point_base + P[tar]*(tar+1)*100 + C[tar]
        if point_max >= G:

            tar_min = (G-point_base) // ((tar+1)*100)
            point = point_base + P[tar]*(tar+1)*100

            if point < G:
                tar_min += 1

            if tar_min < P[tar]:
                num = num_base + tar_min
            else:
                num = num_base + P[tar]
            ans = min(ans,num)

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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)

cnt = np.zeros(D,dtype=int)
P = np.array(P)
C = np.array(C)

ans = sum(P)
cnt_tar = 0

ind_list = np.arange(D)

for bit_seed in range(2**D):

    s_bit = (format(bit_seed, '#016b'))[::-1]
    bit_list = np.array(list(s_bit[:D]),dtype=int)

    cnt = P*bit_list
    num_base = np.sum(cnt)

    point_base_array = (P * (ind_list+1) * 100 + C) * bit_list
    point_base = np.sum(point_base_array)
#    print(point_base_array)

    if point_base >= G:
        num = num_base
        ans = min(ans,num)
    elif num_base > ans:
        continue
    else:
        for i,bit in enumerate(bit_list):
            if bit == 0:
                tar = i

        point_max = point_base + P[tar]*(tar+1)*100 + C[tar]
        if point_max >= G:

            tar_min = (G-point_base) // ((tar+1)*100)
            if tar_min < P[tar]:
                num = num_base + tar_min
            else:
                num = num_base + P[tar]
            ans = min(ans,num)

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

D,G = map(int, input().split())
P = []
C = []

for i in range(D):
#    p,c = min(100,(i+1)*20),1000*(i+1)#map(int,input().split())
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)

cnt = np.zeros(D,dtype=int)
P = np.array(P)
C = np.array(C)

ans = sum(P)
cnt_tar = 0

for bit_seed in range(2**(D)):
    ind_list = list(range(D))
    ind_list = np.array(ind_list)

    s_bit = (format(bit_seed, '#012b'))[::-1]
    bit_list = np.array(list(s_bit[:D]),dtype=int)

    cnt = P*bit_list
    num_base = np.sum(cnt)

    point_base_array = cnt * (ind_list+1) * 100 + C * bit_list
    point_base = np.sum(point_base_array)

    if point_base >= G:
        num = num_base
        ans = min(ans,num)

    else:
        for i,bit in enumerate(bit_list):
            if bit == 0:
                tar = i

        point_max = point_base + P[tar]*(tar+1)*100 + C[tar]
        if point_max >= G:

            tar_min = (G-point_base) // ((tar+1)*100)
            if tar_min < P[tar]:
                num = num_base + tar_min
            else:
                num = num_base + P[tar]
            ans = min(ans,num)

print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

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)

cnt = [0 for _ in range(D)]

ans = sum(P)
cnt_tar = 0

for i in range(D):
    tar = i

    ind_list = list(range(D))
    ind_list.remove(tar)
    ind_list = np.array(ind_list)

    P_part = np.array(P[:tar] + P[tar+1:])
    C_part = np.array(C[:tar] + C[tar+1:])

    cnt_part = np.zeros(D-1,dtype=int)#[0 for _ in range(D-1)]
    point_part = np.zeros(D-1,dtype=int)#[0 for _ in range(D-1)]

    for cnt_tar in range(P[tar]+1):
        point_base = cnt_tar*(tar+1)*100

        num_base   = cnt_tar + C[tar]*max(0,cnt_tar-P[tar] + 1)

        if point_base >= G:
            num = num_base
            ans = min(ans,num)
            break
        else:
            bit_seeds = list(range(2**(D-1)))
            bit_seeds = bit_seeds[::-1]

            for bit_seed in bit_seeds:

                s_bit = (format(bit_seed, '#011b'))[::-1]
                bit_list = np.array(list(s_bit[:D-1]),dtype=int)

                cnt_part = P_part*bit_list
                point_part = cnt_part * (ind_list+1) * 100 + C_part*bit_list

                # for j in range(D-1):
                #     bit = int(s_bit[j:j+1])
                #     cnt_part[j]   = (P_part[j])*bit
                #     point_part[j] = (P_part[j]*(P.index(P_part[j])+1)*100 + C_part[j])*bit
                # print(cnt_part)

                num = num_base + np.sum(cnt_part)
                point = point_base + np.sum(point_part)
#                print(cnt_tar,cnt_part,point)
                if point >= G:
                    # print('point = ',point,'/',G)
                    # print(num)
                    ans = min(ans,num)

                else:
                    break

print(ans)
#     while cnt_part != P_part:
#     ind = 0

#     cnt = kuriage(cnt,P,ind,tar,C,G)
#     print(cnt)
#     if cnt[tar] == -1:
#         cnt = [0 for _ in range(D)]
#         tar += 1

#     if point_over(cnt,P,C,G) and ans > sum(cnt):
#         ans = min(ans, sum(cnt))
# #            print(ans)

# print(ans)


# def kuriage(cnt,P,ind,tar,C,G):

#     if cnt[ind] == 0:
#         cnt[ind:ind+1] = P[ind:ind+1]
#     elif cnt[ind] == P[ind]:
#         if 0 in cnt[:tar] and 0 in cnt[tar+1:]:
#             if ind+1 == tar:
#                 kuriage(cnt,P,ind+2, tar, C, G)
#             else:
#                 kuriage(cnt,P,ind+1, tar, C, G)
#         else:
#             if C[tar] != P[tar]:
#                 C[tar] = C[tar] + 1
#             else:
#                 C[tar] = -1
#     return cnt
# def point_over(cnt,P,C,G):
#     point = 0
#     for i in range(len(P)):
#         point += cnt[i]*100*(i+1)
#         if cnt[i] == P[i]:
#             point += C[i]

#         if point >= G:
#             return True

#     if point < G:
#         return False

# def point(cnt,P,C):
#     point = 0

#     for i,cnt_s in enumerate(cnt):
#         print(cnt_s,'ok')
#         if cnt_s == 0:
#             point += 0
#         else:
#             point += cnt[i]*100*(i+1) + C[i]
#     return point

Submission status: Wrong Answer

Solution code:
import math
D,G = map(int,input().split(" "))
table = []
for i in range(D):
  table.append(list(map(int,input().split(" "))))
j = D-1
ans = 0
while j >= 0:
  if G <= 100*(j+1)*table[j][0]:
    if 100*j*table[j-1][0]+table[j-1][1] < G: 
      ans+=math.ceil(G/(100*(j+1)))
      break
    else:
      if table[j-1][0] >= math.ceil(G/(100*(j+1))):
        ans+=math.ceil(G/(100*(j+1)))
        break 
      else:
        ans+=table[j-1][0]
        break
  elif G <= 100*(j+1)*table[j][0] + table[j][1]:
    ans+=table[j][0]
    break
  else:
    G-=100*(j+1)*table[j][0] + table[j][1]
    ans+=table[j][0]
  j-=1
    
print(ans)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split(" "))
table = []
for i in range(D):
  table.append(list(map(int,input().split(" "))))
j = D-1
ans = 0
while j >= 0:
  if G <= 100*(j+1)*table[j][0]:
    if G%100*(j+1) == 0:
      ans+=int(G/(100*(j+1)))
    else:
      ans+=int(G/(100*(j+1)))+1
    break
  elif G <= 100*(j+1)*table[j][0] + table[j][1]:
    ans+=table[j][0]
    break
  else:
    G-=100*(j+1)*table[j][0] + table[j][1]
    ans+=table[j][0]
  j-=1
    
print(ans)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split(" "))
table = []
for i in range(D):
  table.append(list(map(int,input().split(" "))))
j = D-1
ans = 0
while j >= 0:
  if G <= 100*(j+1)*table[j][0]:
    ans+=int(G/(100*(j+1)))
    break
  elif G <= 100*(j+1)*table[j][0] + table[j][1]:
    ans+=table[j][0]
    break
  else:
    G-=100*(j+1)*table[j][0] + table[j][1]
    ans+=table[j][0]
  j-=1
    
print(ans)

Submission status: Wrong Answer

Solution code:
D,G=map(int, input().split())
scoremap=[list(map(int, input().split())) for d in range(D)]
answer=float('inf')

for i in range(2**D):
  yet=[]
  score=count=0
  for j in range(D):
    if i>>j&1==0:
      yet.append(j)
      continue
    score+=scoremap[j][1]+(j+1)*100*scoremap[j][0]
    count+=scoremap[j][0]
  if score>=G:
    answer=min(count,answer)
    continue
  print(yet)
  for y in reversed(yet):
    temp=0
    while score<G:
      temp+=1
      if temp==scoremap[y][0]:
        break
      score+=(y+1)*100
      count+=1
    else:
      answer=min(count,answer)
      break

print(answer)

Submission status: Wrong Answer

Solution code:
import itertools

d, g = map(int, input().split())
problems = []
for i in range(1, d+1):
    n, c = map(int, input().split())
    problems.append([i*100, n, c])

min_solved = float('inf')
for complete_solved in itertools.product((True, False), repeat=d):
    total_score = 0
    total_sovled = 0
    for i, b in enumerate(complete_solved):
        if not b:
            continue
        s, n, c = problems[i]
        total_score += s*n + c
        total_sovled += n

    for i in range(d-1, -1, -1):
        if complete_solved[i]:
            continue
        s, n, c = problems[i]
        diff = max(g - total_score, 0)
        if (diff + s - 1)//s <= n:
            total_sovled += (diff + s - 1)//s
            min_solved = min(min_solved, total_sovled)
        break
print(min_solved)

Submission status: Wrong Answer

Solution code:
import itertools
import sys

d, g = map(int, input().split())
problems = []
for i in range(1, d+1):
    n, c = map(int, input().split())
    problems.append([i*100, n, c])

min_solved = float('inf')
for complete_solved in itertools.product((True, False),repeat=d):
    total_score = 0
    total_sovled = 0
    for i, b in enumerate(complete_solved):
        if not b:
            continue
        total_score += problems[i][0]*problems[i][1] + problems[i][2]
        total_sovled += problems[i][1]
    print(complete_solved, total_score,total_sovled, file=sys.stderr)

    for i in range(d-1, -1, -1):
        if complete_solved[i]:
            continue
        if (g - total_score + problems[i][0] - 1)//problems[i][0] <= problems[i][1]:
            total_sovled += max((g - total_score +
                                 problems[i][0] - 1)//problems[i][0], 0)
            min_solved = min(min_solved, total_sovled)
        break
print(min_solved)

Submission status: Wrong Answer

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

mincost = float('inf')

for i in range(2**d):
    count = 0
    score = 0
    flag = [0 for _ in range(d)]
    for j in range(d):
        if i >> j == 1:
            flag[j] = 1
            count += problem[j][0]
            score += problem[j][0] * 100 * (j+1) + problem[j][1]
    for k in range(d-1, -1, -1):
        if score >= g:
            mincost = min(mincost, count)
            break
        if flag[k] == 0:
            num = 0
            while num <= problem[k][0] - 1:
                num += 1
                count += 1
                score += 100 * (k+1)
                if score >= g:
                    mincost = min(mincost, count)
                    break
            break

print(mincost)

Submission status: Wrong Answer

Solution code:
import itertools
D, G = [int(_) for _ in input().split()]
SPC = [[100 * (i + 1)] + [int(_) for _ in input().split()] for i in range(D)]
ans = 10000
for flags in itertools.product([0, 1], repeat = D):
    score = G
    count = 0
    for i in range(D):
        if flags[i]:
            score -= SPC[i][0] * SPC[i][1] + SPC[i][2]
            count += SPC[i][1]
    if score > 0:
        count_res = 100
        for i in range(D)[::-1]:
            if not flags[i] and SPC[i][0] * (SPC[i][1] - 1) >= score:
                count_res = score // SPC[i][0]
                break
        count += count_res
    ans = min(count, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
D, G = [int(_) for _ in input().split()]
SPC = [[100 * (i + 1)] + [int(_) for _ in input().split()] for i in range(D)]
ans = 10000
for flags in itertools.product([0, 1], repeat = D):
    score = G
    count = 0
    for i in range(D):
        if flags[i]:
            score -= SPC[i][0] * SPC[i][1] + SPC[i][2]
            count += SPC[i][1]
    if score > 0:
        count_res = 100
        for i in range(D - 1, -1, -1):
            if not (flags[i] or SPC[i][0] * (SPC[i][1] - 1) < score):
                count_res = 1 + (score - 1) // SPC[i][0]
                break
        count += count_res
    ans = min(count, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import itertools
D, G = [int(_) for _ in input().split()]
SPC = [[100 * (i + 1)] + [int(_) for _ in input().split()] for i in range(D)]
ans = 10000
for flags in itertools.product([0, 1], repeat = D):
    score = G
    count = 0
    for i in range(D):
        if flags[i]:
            score -= SPC[i][0] * SPC[i][1] + SPC[i][2]
            count += SPC[i][1]
    if score > 0:
        count_res = 100
        for i in range(D - 1, -1, -1):
            if not (flags[i] or SPC[i][0] * (SPC[i][1] - 1) < score):
                count_res = math.ceil(score / SPC[i][0])
                break
        count += count_res
    ans = min(count, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
D, G = [int(_) for _ in input().split()]
SPC = [[100 * (i + 1)] + [int(_) for _ in input().split()] for i in range(D)]
ans = 10000
for flags in itertools.product([0, 1], repeat = D):
    print(flags)
    score = G
    count = 0
    for i in range(D):
        if flags[i]:
            score -= SPC[i][0] * SPC[i][1] + SPC[i][2]
            count += SPC[i][1]
    if score > 0:
        for i in range(D):
            count_res = 100
            if not flags[i] or SPC[i][0] * (SPC[i][1] - 1) < score:
                count_res = min(count_res, score // SPC[i][0] + 1)
        if count_res == 100:
            continue
        else:
            count += count_res
    ans = min(ans, count)
print(ans)

Submission status: Wrong Answer

Solution code:
d,g = list(map(int, input().split()))
p = []
c = []
for i in range(d):
    p1,c1 = list(map(int, input().split()))
    p.append(p1)
    c.append(c1)
s = 0
for i in range(d):
    for k in range(1, p[i]+1):
        s += k*(100*i+100)
        if s > g:
            break
    else:
        continue

Submission status: Wrong Answer

Solution code:
S = input()

if S[0] != 'A' or not 'C' in S[2:-1]:
    print('WA')
    exit()
n = 1
for i in S[2:-1]:
    if i.islower():
        pass
    elif i == 'C' and n==1:
        n-=1
    else:
        print('WA')
        exit()
print('AC')

Submission status: Wrong Answer

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

for i in range(1 << d):
    score = 0
    haredst_rest_p = -1
    solves = 0
    for j in range(d):
        if i >> j & 1:
            score += (j+1) * 100 * p[j][0] + p[j][1]
            solves += p[j][0]
        else:
            hardest_rest_p = j
    
    if score < g and hardest_rest_p != -1:
        rest = g - score
        if rest > (hardest_rest_p+1) * 100 * (p[hardest_rest_p][0] - 1):
            continue
        else:
            solves += rest // ((hardest_rest_p+1) * 100)
    
    ans = solves if ans > solves else ans
print(ans)

Submission status: Wrong Answer

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

for i in range(1 << d):
    score = 0
    haredst_rest_p = -1
    solves = 0
    for j in range(d):
        if i >> j & 1:
            score += (j+1) * 100 * p[j][0] + p[j][1]
            solves += p[j][0]
        else:
            hardest_rest_p = j
    
    if score < g:
        rest = g - score
        if rest > ((hardest_rest_p+1) * 100) * (p[hardest_rest_p][0] - 1):
            continue
        else:
            solves += rest // ((hardest_rest_p+1) * 100)
    
    ans = solves if ans > solves else ans
print(ans)

Submission status: Wrong Answer

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

for i in range(1 << d):
    score = 0
    haredst_rest_p = -1
    solves = 0
    for j in range(d):
        if i >> j & 1:
            score += (j+1) * p[j][0] * 100 + p[j][1]
            solves += p[j][0]
        else:
            hardest_rest_p = j
    
    if score < g:
        rest = g - score
        if rest > ((hardest_rest_p+1) * 100) * (p[hardest_rest_p][0] - 1):
            continue
        else:
            hardest_rest_must_solve = rest // ((hardest_rest_p+1) * 100)
            ans = solves + hardest_rest_must_solve if ans > solves + hardest_rest_must_solve else ans

print(ans)

Submission status: Wrong Answer

Solution code:

def dfs_biggest_added(i, total_p, total_q):
    if total_p >= g:
        ans.append(total_q)
        return

    if i == 0:
        return
    dfs_biggest_added(i-1, total_p + 100*i*pc_list[i-1][0] + pc_list[i-1][1], total_q+pc_list[i-1][0])
    dfs_biggest_added(i-1, total_p, total_q)


def dfs_not_biggest_added(i, total_p, total_q):
    if total_p >= g:
        ans.append(total_q)
        return

    if i == 0:
        for n in range(1,pc_list[d-1][0]):
            if total_p + 100*d*n >= g:
                ans.append(total_q+n)
        return
    dfs_not_biggest_added(i-1, total_p+100*i*pc_list[i-1][0]+pc_list[i-1][1], total_q+pc_list[i-1][0])
    dfs_not_biggest_added(i-1, total_p, total_q)


d,g = map(int,input().split())
pc_list = [list(map(int,input().split())) for i in range(d)]
ans = []

dfs_biggest_added(d-1, 100*d*pc_list[d-1][0]+pc_list[d-1][1], pc_list[d-1][0])
dfs_not_biggest_added(d-1, 0, 0)

print(min(ans))

Submission status: Wrong Answer

Solution code:
def dfs(i,total_p,total_q):
    print(i,total_q,total_p)

    if total_p >= g:
        ans.append(total_q)
        return

    if i == d:
        return

    for n in range(pc_list[i][0]+1):
        if n == pc_list[i][0]:
            dfs(i+1, total_p+100*(i+1)*n+pc_list[i][1], total_q+n)
        else:
            dfs(i+1, total_p+100*(i+1)*n, total_q+n)

d,g = map(int,input().split())
pc_list = [list(map(int,input().split())) for i in range(d)]
ans = []

dfs(0,0,0)
print(min(ans))

Submission status: Wrong Answer

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

for i in range(2**D):
  point = 0
  count = 0
  i_data = i
  for j in range(D):
    if i & 1:
      point += 100 * (j+1) * pc[j][0] + pc[j][1]
      count += pc[j][0]
      i >>= 1
  if point >= G:
    count_list.append(count)
    break
  else:
    bin_i = bin(i_data)[2:].zfill(D)
    index = bin_i.index('0')
    for j in range(pc[index][0]-1):
        point += 100 * (D-index)
        count += 1
        if point >= G:
          count_list.append(count)
          break
          
print(min(count_list))

Submission status: Wrong Answer

Solution code:
import itertools

def all_comb(iterable):
    for i in range(0, len(iterable) + 1):
        comb = itertools.combinations(iterable, i)
        for pair in comb:
            yield(pair)

def min_solve(goal_point, solve, pc_list):
    solve_point = sum([pc[0] * pc[2] + pc[1] for pc in solve])
    solve_num = sum([pc[0] for pc in solve])
    nc_solve = set(pc_list) - set(solve)
    if solve_point >= goal_point:
        return solve_num
    nc_solve_max = max(nc_solve, key=lambda pc:pc[2])
    if solve_point + (nc_solve_max[0] - 1) * nc_solve_max[2]  >= goal_point:
        min_solve = int((goal_point - solve_point) / nc_solve_max[2] + solve_num)
        return min_solve
    else:
        return float('Inf')

if __name__=='__main__':
    D, G = map(int, input().split())
    pc_list = []
    for i in range(D):
        (p, c) = map(int, input().split())
        pc_list.append((p, c, (i + 1) * 100))
    min_num = min([min_solve(G, solve, pc_list) for solve in all_comb(pc_list)])
    print(min_num)

Submission status: Wrong Answer

Solution code:
import itertools

def all_comb(iterable):
    for i in range(0, len(iterable) + 1):
        comb = itertools.combinations(iterable, i)
        for pair in comb:
            yield(pair)

def min_solve(goal_point, solve, pc_list):
    solve_point = sum([pc[0] * pc[2] + pc[1] for pc in solve])
    solve_num = sum([pc[0] for pc in solve])
    nc_solve = set(pc_list) - set(solve)
    if solve_point > goal_point:
        return float('Inf')
    if solve_point == goal_point:
        return solve_num
    nc_solve_max = max(nc_solve, key=lambda pc:pc[2])
    if solve_point + (nc_solve_max[0] - 1) * nc_solve_max[2]  >= goal_point:
        min_solve = int((goal_point - solve_point) / nc_solve_max[2] + solve_num)
        return min_solve
    else:
        return float('Inf')

if __name__=='__main__':
    D, G = map(int, input().split())
    pc_list = []
    for i in range(D):
        (p, c) = map(int, input().split())
        pc_list.append((p, c, (i + 1) * 100))
    min_num = min([min_solve(G, solve, pc_list) for solve in all_comb(pc_list)])
    print(min_num)

Submission status: Wrong Answer

Solution code:
from math import ceil
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())
_min=101*D

flag=1
while(flag < 2**D):
    
    _G=G
    tmp=0
    max_ind=0
    for i in range(D):
        if(flag & 1<<i):
            _G-=p[i]*(i+1)*100 + c[i]
            tmp+=p[i]
        else:
            max_ind=i
    k=ceil( max([(_G),0]) / (100*(max_ind+1)) )  
    if(k < p[max_ind] or k==0):
        tmp+=k
        _min=min([tmp,_min])
    flag+=1
print(_min)

Submission status: Wrong Answer

Solution code:
from math import ceil
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())
_min=101*D

flag=1
while(flag < 2**D):
    
    _G=G
    tmp=0
    max_ind=0
    for i in range(D):
        if(flag & 1<<i):
            _G-=p[i]*(i+1)*100 + c[i]
            tmp+=p[i]
        else:
            max_ind=i
    k=ceil(max([(_G),0])/(100*(max_ind+1)))  
    if(k < p[max_ind]):
        tmp+=k
        _min=min([tmp,_min])
    flag+=1
print(_min)

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())
_min=101*D

flag=1
count=0
while(flag < 2**(D)):
    
    _G=G
    tmp=0
    max_ind=0
    for i in range(D):
        if(flag & 1<<i):
            _G-=p[i]*(i+1)*100 + c[i]
            tmp+=p[i]
        else:
            max_ind=i
    k=max([(_G-1),-1])//(100*(max_ind+1))+1    
    if(k < p[max_ind]):
        count+=1
        tmp+=k
        _min=min([tmp,_min])
    flag+=1
print(_min)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
p=[0]*D
c=[0]*D
_max=[0]*D
for i in range(D):
    p[i],c[i]=map(int,input().split())


kosupa={}
for i in range(D):
    kosupa[i]=100*(i+1) + c[i]/p[i]

sorted_kosupa=sorted(kosupa.items(),key=lambda x:x[1])

result=[]
sousa=[]
while(1):
    tmp=sorted_kosupa.pop()
    min_num=p[tmp[0]]
    min_ind=tmp[0]
    for i in range(D):
        if(i in sousa):
            continue
        tmp_num=(G-1)//(100*(i+1))+1
        if(tmp_num <= min_num and tmp_num<=p[i]):
            min_num=tmp_num
            min_ind=i
    result.append([min_ind,min_num])
    G-=100*(min_ind+1)*min_num
    if(min_num==p[min_ind]):
        G-=c[min_ind]
    sousa.append(min_ind)
    if(G<=0):
        break

total=0
for k in result:
    total+=k[1]

print(total)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
p=[0]*D
c=[0]*D
_max=[0]*D
for i in range(D):
    p[i],c[i]=map(int,input().split())


kosupa={}
for i in range(D):
    kosupa[i]=100*(i+1) + c[i]/p[i]

sorted_kosupa=sorted(kosupa.items(),key=lambda x:x[1])

result=[]
sousa=[]
while(1):
    tmp=sorted_kosupa.pop()
    min_num=p[tmp[0]]
    min_ind=tmp[0]
    for i in range(D):
        if(i in sousa):
            continue
        tmp_num=(G-1)//(100*(i+1))+1
        if(tmp_num < min_num and tmp_num<=p[i]):
            min_num=tmp_num
            min_ind=i
    result.append([min_ind,min_num])
    G-=100*(min_ind+1)*min_num
    if(min_num==p[min_ind]):
        G-=c[min_ind]
    sousa.append(min_ind)
    if(G<=0):
        break

total=0
for k in result:
    total+=k[1]

print(total)