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 ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

D,G = II()
p,c = Line(D)

def dfs(point,p):
    if point<=0:
        return 0
    else:
        ret = []
        for i in range(D):
            if p[i]==0:
                continue
            if math.ceil(point//((i+1)*100)) <= p[i]:
                ret.append(math.ceil(point//((i+1)*100)))
            else:
                temp = p[i]
                p[i] = 0
                ret.append(dfs(point-100*(i+1)*temp-c[i],p)+temp)
                p[i] = temp
        return min(ret)

print(dfs(G,p))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10000)
D, G = list(map(int, input().split(' ')))
left = {}
bonus = {}
for i in range(1, D+1):
    left[i], bonus[i] = list(map(int, input().split(' ')))
 
big = 9999999
 
probably_ans = big
def hogehoge(depth, index, pt, left, bonus, probably_ans):
    if pt >= G:
        return depth
    if depth >= probably_ans or index > D:  # 遅いかも
        return big
    
    # 全部引いて index reset
    for k in range(0, D - index):
        if left[index + k]:
            temp = left[index + k]
            left[index + k] = 0
            probably_ans = min(probably_ans, hogehoge(depth+temp, 1, pt + (index + k) * 100 * temp + bonus[index + k], left, bonus, probably_ans))
            left[index + k] = temp

    # 一つも引かない
    probably_ans = min(probably_ans, hogehoge(depth, index + 1, pt, left, bonus, probably_ans))
    
    # 歯抜け状態から行けそうならクリア
    if left[index]:
        if pt + index * 100 * left[index] + bonus[index] >= G:
            for i in range(1, left[index] + 1):
                left[index] = left[index] - i
                probably_ans = min(probably_ans, hogehoge(depth+i, index+1, pt + index * 100 * i + bonus[index] * (left[index] == 0), left, bonus, probably_ans))
                left[index] = left[index] + i
    return probably_ans
    
print(hogehoge(0, 1, 0, left, bonus, probably_ans))

Submission status: Wrong Answer

Solution code:
import heapq

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

problems = []
for i in range(D):
    p, c = map(int, input().split())
    total_score = 100 * (i + 1) * p + c
    score_per_problem = total_score / p
    problems.append([i + 1, p, c, total_score, score_per_problem])

p_sorted_per = sorted(problems, key=lambda x : x[4], reverse=True)
p_sorted_total = sorted(problems, key=lambda x : x[3], reverse=True)
score = 0
count = 0

def confirm_score():
    count1 = []
    for p in p_sorted_total:
        if score + p[3] >= G:
            heapq.heappush(count1, p[1])
            
    
    count2 = 0
    for p in reversed(problems):
        div, mod = divmod((G - score), (100 * p[0]))
        if mod != 0:
            div += 1
        if div <= p[1]:
            count2 += div
            break
        
    return min(heapq.heappop(count1), count2)
            

for p in p_sorted_per:
    if score + 100 * problems[-1][0] * (problems[-1][1] - 1) >= G:
        count += confirm_score()
        break
    else:
        score += p[3]
        count += p[1]
        p_sorted_total.remove(p)
        problems.remove(p)
    
    if score == G:
        break

print(count)

Submission status: Wrong Answer

Solution code:
import heapq

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

problems = []
for i in range(D):
    p, c = map(int, input().split())
    total_score = 100 * (i + 1) * p + c
    score_per_problem = total_score / p
    problems.append([i + 1, p, c, total_score, score_per_problem])

p_sorted_per = sorted(problems, key=lambda x : x[4], reverse=True)
p_sorted_total = sorted(problems, key=lambda x : x[3], reverse=True)
score = 0
count = 0

def confirm_score():
    count1 = []
    for p in p_sorted_total:
        if score + p[3] >= G:
            heapq.heappush(count1, p[1])
            
    
    count2 = 0
    for p in reversed(problems):
        div, mod = divmod((G - score), (100 * p[0]))
        if mod != 0:
            div += 1
        if div <= p[1]:
            count2 += div
            break
        else:
            continue

    return min(heapq.heappop(count1), count2)
            

for p in p_sorted_per:
    if score + p[3] > G:
        count += confirm_score()
        break
    else:
        score += p[3]
        count += p[1]
        p_sorted_total.remove(p)
        problems.remove(p)
    
    if score == G:
        break

print(count)

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_solved = 1000

def dfs(depth, solve_num, point, sum_solved):
    global min_solved

    point += (depth+1) * 100 * solve_num
    if solve_num == p[depth]:
        point += c[depth]
    
    if point >= G:
        if sum_solved < min_solved:
            min_solved = sum_solved
        return 0

    if depth == len(p) - 1:
        return 0

    for i in range(p[depth+1]+1):
        dfs(depth+1, i, point, sum_solved + i)

    return 0

for i in range(p[0]):
    dfs(0, i, 0, i)

print(min_solved)
print("\n")

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

num = []
# 完全に解くか解かないかを選ぶ
for i in range(2**D):
    score = 0
    num_tmp = 0  # 解いた問題数
    not_comp = []  # 解いていないもの
    for j in range(D):
        if i >> j & 1:
            score += p[j] * 100 * (j + 1) + c[j]
            num_tmp += p[j]
        else:
            not_comp.append(j)
    print("not_comp:", not_comp)

    for j in not_comp[::-1]:
        if score < G:
            num_j = min(p[j] - 1, (G - score - 1) // (100 * (j + 1)) + 1)
            score += num_j * 100 * (j + 1)
            num_tmp += num_j
    print("num_tmp:", num_tmp)

    if score >= G:
        num.append(num_tmp)
    print("num:", num)

ans = min(num)
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())

num = []
# 完全に解くか解かないかを選ぶ
for i in range(2**D):
    score = 0
    num_tmp = 0  # 解いた問題数
    not_comp = []  # 解いていないもの
    for j in range(D):
        if i >> j & 1:
            score += p[j] * 100 * (j + 1) + c[j]
            num_tmp += p[j]
        else:
            not_comp.append(j)
    print("not_comp:", not_comp)

    for j in not_comp[::-1]:
        if score < G:
            num_j = min(p[j] - 1, (G - score) // (100 * (j + 1)))
            score += num_j * 100 * (j + 1)
            num_tmp += num_j
    print("num_tmp:", num_tmp)

    if score >= G:
        num.append(num_tmp)
    print("num:", num)

ans = min(num)
print(ans)

Submission status: Wrong Answer

Solution code:
def solve(levelNum, levelProblemNums, extraPoints, target):
	target = int(target / 100)
	dp = [[99999999] * (target+1) for _ in range(levelNum+1)]
	for i in range(levelNum+1):
		dp[i][0] = 0
	#print(dp)
	#print(target)
	return 0
    # for each level
	for l in range(1, levelNum+1):
		#for each point
		#print( l)
		for point in range(1, target+1):
			dp[l][point] = dp[l-1][point]
			for p in range(1, levelProblemNums[l-1]+1):
				curPoint = p*l if p < levelProblemNums[l-1] else p*l + int(extraPoints[l-1]/100)
				subPoint = point - curPoint if point > curPoint else 0
				dp[l][point] = min(dp[l-1][subPoint]+p, dp[l][point])
				if subPoint == 0: break;

	return dp[l][target]	

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)

rt = solve(D, P, C, G)
print(rt)

Submission status: Wrong Answer

Solution code:
def dfs(res, depth, path, P, C, G):
    if sum(P[index]*100 for index in path) >= G:
        res[0] = min(res[0], len(path))
        return
    elif depth == len(C)-1:
        return
    for j in range(P[depth]+1):
        if j == P[depth]:
            dfs(res, depth+1, path + [depth] * j, P, C, G-C[depth])
        else:
            dfs(res, depth+1, path + [depth] * j, P, C, G)

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)

res = [sum(P)]
dfs(res, 0, [], P, C, G)
print(res[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#%%
import itertools
import math

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

l = list(itertools.product(range(2), repeat=D))
score_list = []
for i in range(len(l)):
    tmp1 = 0
    tmp2 = []
    tmp3 = -1
    tmp5 = 0
    for j in range(D):
        if l[i][j] == 0:
            tmp2.append(j)
            pass
        else:
            tmp1 += com[j][0]
            tmp5 += com[j][1]
    if len(tmp2) != 0:
        tmp3 = tmp2[-1]
    if tmp3 != -1:
        tmp4 = tmp1 + (tmp3+1) * 100 * (p[tmp3]-1)
    else:
        tmp4 = tmp1
    
    score_list.append([tmp1, tmp3, tmp4, tmp5])

#print(score_list)

ans_list = []

for i in range(len(score_list)):
    if score_list[i][1] != -1:
        if score_list[i][0]<= G and score_list[i][2] >= G:
            tmp = math.ceil((G - score_list[i][0]) / ((score_list[i][1]+1)*100))
            ans = score_list[i][3] + tmp
            ans_list.append(ans)
            print(score_list[i][3], ans)
    else:
        if score_list[i][0]>= G:
            ans_list.append(score_list[i][3])

#print(ans_list)
print(min(ans_list))

Submission status: Wrong Answer

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

ans = float("inf")
for bit in range(1 << D) :
    A = []
    score = 0
    solved = 0
    for k in range(D) :
        if bit & (1 << k) :
            A.append(k)
            score += 100*(k+1)*P[k] + C[k]
            solved += P[k]
    if score < G :
        for k in range(D-1,-1,-1) :
            if k in A :
                continue
            if G-score > 100*(k+1)*P[k] :
                score += 100*(k+1)*P[k] + C[k]
                solved += P[k]
            else :
                solved += (G-score)//(100*(k+1)*P[k]) + ((G-score)%(100*(k+1)*P[k]) != 0)
                break
    print(solved,A)
    ans = min(ans, solved)
print(ans)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter

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

def com(d, s, ans):
    if d == D:
        ans.append(s)
        return ans
    a = s[:]
    a.append(1)
    ans = com(d+1, a, ans)
    b = s[:]
    b.append(0)
    ans = com(d+1, b, ans)
    return ans

L = com(0, [], [])
ans = 10000
for l in L:
    point = 0
    probs = 0
    uncom = []
    for i, com in enumerate(l):
        if com == 0:
            uncom.append(i)
        else:
            p, c = PC[i]
            point += (i+1)*100*p + c
            probs += p
    #print(probs, l)
    if point >= G:
        ans = min(ans, probs)
        continue
    uncom.sort(reverse=True)
    re = G - point
    for un in uncom:
        p, c = PC[un]
        #print(re, probs, p)
        if (un+1)*100*(p-1) >= re:
            probs += re // ((un+1)*100)
            re = 0
            break
        re -= (un+1)*100*(p-1)
        probs += p-1
    #print(probs)
    if re > 0:
        continue
    ans = min(ans, probs)
print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
import math
pc = []
for i in range(d):
    pc.append(list(map(int,input().split())))
ans = 10000
for i in range(2**d-1):
    score = 0
    num = 0
    for j in range(d):
        if i>>j & 1 == 1:
            score += pc[j][0]*(j+1)*100+pc[j][1]
            num += pc[j][0]
    for j in range(d-1,-1,-1):
        if i>>j & 1 == 0:
            if g>score:
                so = math.ceil((g-score)/((j+1)*100))
                if so < pc[j][0]:
                    ans = min(ans,num+so)
            else:
                ans = min(ans,num)
print(ans)

Submission status: Wrong Answer

Solution code:
from math import ceil

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

pc_list = [[i]+list(map(int,input().split())) for i in range(D)]
def rindex_zero(l):
    return len(l) - l[::-1].index(0)-1

def func(g,cnt,l):
    if len(l) == D:
        if g <= 0:
            return cnt
        idx = rindex_zero(l)
        i,p,c = pc_list[idx]
        if g <= 100*(i+1)*(p-1):
            for j in range(1,p):
                cnt += 1
                g -= 100*(i+1)
                if g <= 0:
                    return cnt
        return 10**9
    length = len(l)
    i,p,c = pc_list[length]
    print(i,p,c,l)
    a = func(g-(100*(i+1)*p+c), cnt+p,l+[1])
    b = func(g, cnt,l +[0])
    return min(a,b)
        
print(func(G,0,[]))

Submission status: Wrong Answer

Solution code:
from math import ceil

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

pc_list = [[i]+list(map(int,input().split())) for i in range(D)]
def rindex_zero(l):
    return len(l) - l[::-1].index(0)-1

def func(g,cnt,l):
    if len(l) == D:
        if g <= 0:
            return cnt
        idx = rindex_zero(l)
        i,p,c = pc_list[idx]
        if g <= 100*(i+1)*(p-1):
            cnt += ceil(g/(100*(i+1)))
            return cnt
        return 10**9
    length = len(l)
    i,p,c = pc_list[length]
    print(i,p,c,l)
    a = func(g-(100*(i+1)*p+c), cnt+p,l+[1])
    b = func(g, cnt,l +[0])
    return min(a,b)
        
print(func(G,0,[]))

Submission status: Wrong Answer

Solution code:
from math import ceil

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

pc_list = [[i]+list(map(int,input().split())) for i in range(D)]
def rindex_zero(l):
    return len(l) - l[::-1].index(0)-1

def func(g,cnt,l):
    if len(l) == D:
        if g <= 0:
            return cnt
        idx = rindex_zero(l)
        i,p,c = pc_list[idx]
        if g < 100*(i+1)*(p-1):
            cnt += ceil(g/(100*(i+1)))
            return cnt
        return 10**9
    length = len(l)
    i,p,c = pc_list[length]
#     print(i,p,c,l)
    a = func(g-(100*(i+1)*p+c), cnt+p,l+[1])
    b = func(g, cnt,l +[0])
    return min(a,b)
        
print(func(G,0,[]))

Submission status: Wrong Answer

Solution code:
from math import ceil

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

pc_list = [[i]+list(map(int,input().split())) for i in range(D)]

def add_mean_score(g,pc_list):
    pcmean = []
    for i,p,c in pc_list:
#         print(i,p,c)
        if p == 0:
            continue
        p_sum = 100*(i+1)*p
        if p_sum > g:
            m = 100*(i+1)
        elif p_sum <= g < p_sum + c:
            m = g/p
        else:
            m = (p_sum + c) / p
        
        pcmean.append([i,p,c,m])
    return pcmean

cnt = 0
while G>0:
    pcm = add_mean_score(G,pc_list)
    pcm.sort(key=lambda x:-x[3])
    i,p,c,_ = pcm[0]
    pc_list[i] = [i,0,0]
#     print(i,p,c)
    p_sum = 100*(i+1)*p
    if G <= p_sum:
        tmp_cnt = ceil(G/(100*(i+1)))
        cnt += tmp_cnt
        break
    else:
        cnt += p
        G -= p_sum+c
        
print(cnt)

Submission status: Wrong Answer

Solution code:
from math import ceil

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

pc_list = [[i]+list(map(int,input().split())) for i in range(D)]

def add_mean_score(g,pc_list):
    pcmean = []
    for i,p,c in pc_list:
#         print(i,p,c)
        if p == 0:
            continue
        p_sum = 100*(i+1)*p
        if p_sum > g:
            m = 100*(i+1)
        elif p_sum <= g < p_sum + c:
            m = g/p
        else:
            m = (p_sum + c) / p
        
        pcmean.append([i,p,c,m])
    return pcmean

cnt = 0
while G>0:
    pcm = add_mean_score(G,pc_list)
    pcm.sort(key=lambda x:-x[3])
    i,p,c,_ = pcm[0]
    pc_list[i] = [i,0,0]
#     print(i,p,c)
    p_sum = 100*(i+1)*p
    if G <= p_sum:
        tmp_cnt = ceil(G/(100*(i+1)))
        cnt += tmp_cnt
        G -= tmp_cnt * (100*(i+1))
    else:
        cnt += p
        G -= p_sum+c
        
print(cnt)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())

lst = [list(map(int, input().split())) for i in range(D)]
ref = []
for i,v in enumerate(lst):
  ref.append([v[0],v[0]*(i+1)*100 + v[1]])
ref.sort(key=lambda x: x[0])
ans = 0
cnt = 0
flag = False
for i in range(D):
  for j in range(lst[-i-1][0]):
    ans += (D - i) * 100
    if (j == lst[-i-1][0] - 1):
      ans += lst[-i-1][1]
    cnt += 1
    if (ans >= G):
      flag = True
      break
  if flag:
    break
for i in ref:
  if (i[1] >= G and cnt > i[0]):
    cnt = i[0]
print(cnt)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())

lst = [list(map(int, input().split())) for i in range(D)]

ans = 0
cnt = 0
flag = False
for i in range(D):
  for j in range(lst[-i-1][0]):
    ans += (D - i) * 100
    if (j == lst[-i-1][0] - 1):
      ans += lst[-i-1][1]
    cnt += 1
    if (ans >= G):
      flag = True
      break
  if flag:
    break
print(cnt)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())

lst = [list(map(int, input().split())) for i in range(D)]

ans = 0
cnt = 0
flag = False
for i in range(D):
  for j in range(lst[-i-1][0]):
    ans += (D - i) * 100
    if (j == lst[-i-1][0] - 1):
      ans += lst[-i-1][1]
    print(ans)
    cnt += 1
    if (ans >= G):
      flag = True
      break
  if flag:
    break
print(cnt)

Submission status: Wrong Answer

Solution code:
import math


score_max, total = list(map(int, input().split()))
total //= 100
per_score_num = []
bonus = []
for i in range(score_max):
    inp = list(map(int, input().split()))
    per_score_num.append(inp[0])
    bonus.append(int(inp[1] / 100))
    

require = 0
min_cnt = float('inf')


for bits in range(1 << score_max):
    solve_cnt = 0
    score = 0
    for i in range(score_max):
        if (1<<i)&bits:
            score += per_score_num[i] * (i+1)
            score += bonus[i]
            solve_cnt += per_score_num[i]
    if total > score:
        for j in range(score_max-1, -1, -1):
            if not (1<<j) & bits:
                require = math.ceil((total - score) // (j+1))
                if require < per_score_num[j]:
                    solve_cnt += require
                else:
                    solve_cnt = float('inf')
                break
    min_cnt = min(min_cnt, solve_cnt)
print(min_cnt)

Submission status: Wrong Answer

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

num = 2**d

score = 0
ans = 0

use = [0,1]

def nokori(use,score):
    tmp = 0
    for i in range(d):
        #print(use, d-1-i, d-1-i not in use)
        if d-1-i not in use:
            if pc[d-1-i][0] * (d-1-i+1) * 100 >= score:
                tmp += (score +(d-1-i+1) * 100 - 1) // ( (d-1-i+1) * 100 )
                return tmp
            elif pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1] >= score:
                tmp += pc[d-1-i][0]
                return tmp
            else:
                tmp += pc[d-1-i][0]
                score -= pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1]
kouho = []

kouho.append(nokori([-1],g))
#exit()

for i in range(num):
    use = []
    ans = 0
    score = 0
    cur = i
    #print(i)
    for j in range(d):
        if cur% 2 == 0:
            #print(i % 2,j)
            score += pc[j][0] * (j+1) * 100 + pc[j][1]
            ans += pc[j][0]
            use.append(j)
            #print(use,j,cur)
        else:
            cur -= 1
            continue
        cur = cur // 2
    if score >= g:
        kouho.append(ans)
    else:
        #print(use)
        #print(ans,score)
        kouho.append(ans+nokori(use,g-score))
        #print(ans+nokori(use,d-score))

#print(kouho)
kouho.sort()
print(kouho[0])

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc104/tasks/abc104_c


def solve(D, G, ps, cs):
  ans = 100000000
  for mask in range(1 << D):
    s = 0
    num = 0
    rest_max = -1
    for i in range(D):
      if mask >> i & 1:
        s += 100 * (i+1) * ps[i] + cs[i]
        num += ps[i]
      else:
        rest_max = i
    if s < G:
      s1 = 100 * (rest_max + 1)
      need = (G - s + s1 - 1) / s1
      if need >= ps[rest_max]:
        continue
      num += need
    ans = min(ans, num)
  return ans
  

if __name__ == '__main__':
  D, G = map(int, input().split(' '))
  ps = []
  cs = []
  for i in range(D):
    p, c = map(int, input().split(' '))
    ps.append(p)
    cs.append(c)
  print(solve(D, G, ps, cs))

Submission status: Wrong Answer

Solution code:
import itertools


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

P     = [None] * D
C     = [None] * D
count = [None] * D
score = [None] * D

for i in range(D):
    p, c          = map(int, input().split())
    P[i]          = p
    C[i]          = c
    count[i]      = list(range(p+1))
    score[i]      = [100 * (i+1) * j for j in range(p+1)]
    score[i][-1] += c

answer = sum(P)

for is_complete in itertools.product([True, False], repeat=D):
    score_tmp  = 0
    count_tmp  = 0
    score_tmp += sum([score[i][-1] for i in range(D) if is_complete[i]])
    count_tmp += sum([count[i][-1] for i in range(D) if is_complete[i]])
    if score_tmp < G:
        for i in list(range(D))[::-1]:
            if is_complete[i] == False:
                if (G - score_tmp) % (100 * (i+1)) == 0:
                    count_add  = min((G - score_tmp) // (100 * (i+1)),     P[i] - 1)
                else:
                    count_add  = min((G - score_tmp) // (100 * (i+1)) + 1, P[i] - 1)
                score_add      = 100 * (i+1) * count_add
                count_tmp     += count_add
                score_tmp     += score_add
            if score_tmp >= G:
                break
    answer = min(answer, count_tmp)

print(answer)

Submission status: Wrong Answer

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

num = 2**d

score = 0
ans = 0


def nokori(use,score):
    tmp = 0
    for i in range(d):
        if d-1-i not in use:
            if pc[d-1-i][0] * (d-1-i+1) * 100 >= score:
                tmp += (score +(d-1-i+1) * 100 - 1) // ( (d-1-i+1) * 100 )
                return tmp
            elif pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1] >= score:
                tmp += pc[d-1-i][0]
                return tmp
            else:
                tmp += pc[d-1-i][0]
                score -= pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1]
kouho = []

kouho.append(nokori([-1],g))
#exit()

for i in range(num):
    use = []
    ans = 0
    score = 0
    #print(i)
    for j in range(d):
        #print(i % 2)
        if i % 2 == 0:
            score += pc[j][0] * (j+1) * 100 + pc[j][1]
            ans += pc[j][0]
            use.append(j)
        else:
            continue
        i = i // 2
    if score >= g:
        kouho.append(ans)
    else:
        #print(ans,score)
        kouho.append(ans+nokori(use,g-score))
        #print(ans+nokori(use,d-score))

#print(kouho)
kouho.sort()
print(kouho[0])

Submission status: Wrong Answer

Solution code:
import itertools


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

P     = [None] * D
C     = [None] * D
count = [None] * D
score = [None] * D

for i in range(D):
    p, c          = map(int, input().split())
    P[i]          = p
    C[i]          = c
    count[i]      = list(range(p+1))
    score[i]      = [100 * (i+1) * j for j in range(p+1)]
    score[i][-1] += c

count = [sum(c) for c in list(itertools.product(*count))]
# score = [sum(s) for s in list(itertools.product(*score))]

# answer = [count[i] for i in range(len(count)) if score[i] >= G]

# print(min(answer))
print(0)

Submission status: Wrong Answer

Solution code:
import itertools


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

P     = [None] * D
C     = [None] * D
count = [None] * D
score = [None] * D

for i in range(D):
    p, c          = map(int, input().split())
    P[i]          = p
    C[i]          = c
    count[i]      = list(range(p+1))
    score[i]      = [100 * (i+1) * j for j in range(p+1)]
    score[i][-1] += c

count = [sum(c) for c in list(itertools.product(*count))]
score = [sum(s) for s in list(itertools.product(*score))]

# answer = [count[i] for i in range(len(count)) if score[i] >= G]

# print(min(answer))
print(0)

Submission status: Wrong Answer

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

num = 2**d

score = 0
ans = 0


def nokori(use,score):
    tmp = 0
    for i in range(d):
        if d-1-i not in use:
            if pc[d-1-i][0] * (d-1-i+1) * 100 >= score:
                tmp += (score +(d-1-i+1) * 100 - 1) // ( (d-1-i+1) * 100 )
                return tmp
            elif pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1] >= score:
                tmp += pc[d-1-i][0]
                return tmp
            else:
                tmp += pc[d-1-i][0]
                score -= pc[d-1-i][0] * (d-1-i+1) * 100 + pc[d-1-i][1]
kouho = []

kouho.append(nokori([-1],g))
#exit()

for i in range(num):
    use = []
    for j in range(d):
        if num % 2 == 0:
            score += pc[j][0] * (j+1) * 100 + pc[j][1]
            ans += pc[j][0]
            use.append(j)
        else:
            continue
        num = num // 2
    if score >= g:
        kouho.append(ans)
    else:
        kouho.append(ans+nokori(use,d-score))

#print(kouho)
kouho.sort()
print(kouho[0])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(D: int, G: int, p: "List[int]", c: "List[int]"):
    mn = 1e5
    for i in range(1 << D):
        score = 0
        count = 0
        for j in range(D):
            if i >> j & 1 == 1:
                score += p[j] * 100 * (j+1) + c[j]
                count += p[j]
        counter = 0
        while(score < G and counter <= D):
            flag = True
            for k in range(D):
                j = D - k - 1
                if i >> j & 1 == 0:
                    if score + 100*(j+1)*(p[j]-1) >= G:
                        count += math.ceil((G - score) / (100*(j+1)))
                        flag = False
                        break
                    else:
                        score += 100*(j+1)*(p[j]-1)
                        count += p[j] - 1
            if not flag:
                break
            counter += 1
        mn = min(mn, count)
    print(mn)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    D = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    p = [int()] * (D)  # type: "List[int]" 
    c = [int()] * (D)  # type: "List[int]" 
    for i in range(D):
        p[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(D, G, p, c)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(D: int, G: int, p: "List[int]", c: "List[int]"):
    mn = 1e5
    for i in range(1 << D):
        score = 0
        count = 0
        for j in range(D):
            if i >> j & 1 == 1:
                score += p[j] * 100 * (j+1) + c[j]
                count += p[j]
        counter = 0
        while(score < G and counter <= D):
            flag = True
            for k in range(D):
                j = D - k - 1
                if i >> j & 1 == 0:
                    if score + 100*(j+1)*(p[j]-1) >= G:
                        count += math.ceil((G - score) / (100*(j+1)))
                        flag = False
                        break
                    else:
                        score += 100*(j+1)*(p[j]-1)
                        count += p[j] - 1
            if not flag:
                break
            counter += 1
        mn = min(mn, count)
    print(mn)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    D = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    p = [int()] * (D)  # type: "List[int]" 
    c = [int()] * (D)  # type: "List[int]" 
    for i in range(D):
        p[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(D, G, p, c)

if __name__ == '__main__':
    main()