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:
# 一番基礎点の低いものに注目
# 完全に埋める or 部分的に埋める
# 部分的に埋める場合、高位の問題は全て解いている

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

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

INF = 10 ** 18
def F(i = 1, G = G):
  # i番目以上の問題だけを使う場合
  if G <= 0:
    return 0
  if i == D+1:
    return INF
  full_upper = sum(full_score[i+1:])
  # 放置する場合
  x = F(i+1, G)
  # 完全に埋める場合
  y = P[i] + F(i+1, G - full_score[i])
  # 部分的に埋める場合。このとき上位の問題は完全に埋めている
  if 100 * i * P[i] + full_upper < G:
    z = INF
  else:
    z = sum(P[i+1:]) + max(0, (G - full_upper) // (100*i))
  return min(x,y,z)

answer = F()
print(answer)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split()) 
box=[] 
for i in range(D): 
    box.append(list(map(int,input().split()))) 
box.insert(0,[0,0]) #数を１番目に合わせるため 
info=[[0,0] for i in range(2**D)] #各全完の組での点数、解いた問題数の記憶
info2=[[0]*(D+1) for i in range(2**D)] #i番目を何問解いているか？

for i in range(2*D): #全完したものをinfoに追加
    for j in range(1,D+1): #100j点の問題は全完するか 
        if (i>>(j-1))&1: 
            info[i][0]+=box[j][1]+j*100*box[j][0] 
            info[i][1]+=box[j][0] 
            info2[i][j]=box[j][0] #ｊ番目を全問解いている。

for i in range(2**D):
    score=G-info[i][0]
    if score<=0:
        continue
    else:
        n=D
        while score>0:
            num=box[n][0]-info2[i][n] #残りの問題数
            #print(num)
            #print(str(i)+":"+str(score))
            if num!=0:
                for j in range(1,num+1):
                    score -= 100*n
                    info[i][1]+=1 #i番目の解いた数を増やす
                    if j==num: #ボーナス点追加
                        score-=box[n][1]
                    if  score<=0:
                        break
            n-=1
            
l=len(info)
for i in range(l-1):
    min=info[i][1]
    m=info[i]
    t=i
    for j in range(i+1,l):
        if min>info[j][1]:
            min=info[j][1]
            t=j
    info[i]=info[t]
    info[t]=m
print(info[0][1])

Submission status: Wrong Answer

Solution code:

D, G = map(int,input().split())
lis = [] #平均点順にソートする


for i in range(D):

    p, c = map(int,input().split())

    if p * (i + 1) + c <= G:
        value = (p * 100 *(i + 1) + c) / p
        flag = True
        
    else:
        value = (i + 1)*100
        flag = False
        
        
    lis.append ([p , c , i + 1 , value , flag])


ans = 0
while G > 0:

    lis.sort(key=lambda x:x[3])
    lis.reverse()

    #print ("ans:",ans," G:",G)
    #print (lis)

    if lis[0][4]:
        G -= ( lis[0][0] * 100 *lis[0][2] + lis[0][1] )
        ans += lis[0][0]
        del lis[0]

    else:
        if G % (100 * lis[0][2]) == 0:
            add = 0
        else:
            add = 1
            
        ans += (G // (100 * lis[0][2])) + add
        break


    for i in lis:

        if G >= i[0] * 100 * i[2] + i[1]:
            i[3] = (i[0] * 100 * i[2] + i[1] ) / i[0]
            i[4] = True

        else:
            i[3] = i[2] * 100
            i[4] = False

print (ans)

Submission status: Wrong Answer

Solution code:

D, G = map(int,input().split())
lis = [] #平均点順にソートする


for i in range(D):

    p, c = map(int,input().split())

    if p * (i + 1) + c <= G:
        value = (p * 100 *(i + 1) + c) / p
        flag = True
        
    else:
        value = (i + 1)*100
        flag = False
        
        
    lis.append ([p , c , i + 1 , value , flag])


ans = 0
while G > 0:

    lis.sort(key=lambda x:x[3])
    lis.reverse()

    #print (lis)

    if lis[0][4]:
        G -= ( lis[0][0] * 100 *lis[0][2] + lis[0][1] )
        ans += lis[0][0]
        del lis[0]

    else:
        ans += G // (100 * lis[0][2])
        break


    for i in lis:

        if G >= i[0] * 100 * i[2] + i[1]:
            i[3] = (i[0] * 100 * i[2] + i[1] ) / i[0]
            i[4] = True

        else:
            i[3] = i[1] * 100
            i[4] = False

print (ans)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
G = G//100
pc = []

for i in range(D):
    p,c = map(int,input().split())
    pc.append((p,c//100))

ans = 1e9

for i in range(1<<D):
    points = 0
    cost = 0
    for j in range(D):
        jbit = ((i>>j)&1)
        
        points += jbit*( (j+1)*pc[j][0] + pc[j][1])
        cost += jbit * pc[j][0]
        
    if points >= G:
        ans = min(ans,cost)
        continue
    res = G - points
    for k in range(D-1,-1,-1):
        kbit = ((i>>k)&1)
        if not kbit:
            test = res // (k+1)
            #print(test)
            if test <= pc[k][0]-1:
                res = 0
                cost += test
                ans = min(ans, cost)
            else:
                res -= (k+1)*(pc[k][0]-1)
                cost += pc[k][0]-1
    
print(ans)

Submission status: Wrong Answer

Solution code:
from math import ceil
D,G = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(D)]
result = []
for i in  range(2**D):
    ans = 0
    cnt = 0
    num = format(i,"b").zfill(D)
    for j in range(D,0,-1):

        if num[j-1] == "1" :
            ans += para[j-1][0] *100*j + para[j-1][1]
            cnt += para[j-1][0]
            
        else : pass

    if ans >= G :
        result.append(cnt)
    else :
        for j in range(D,0,-1):
            if num[j-1] == "1" : pass
            else : 
                if G <= ans + (para[j-1][0]-1)*100*(j):
                    cnt += ceil((G-ans)//(100*(j)))
                    result.append(cnt) 
                
print(min(result))

Submission status: Wrong Answer

Solution code:
from math import ceil
D,G = map(int,input().split())
para = [[i for i in map(int,input().split())] for j in range(D)]
result = []
for i in  range(2**D):
    ans = 0
    cnt = 0
    num = format(i,"b").zfill(D)
    for j in range(D,0,-1):

        if num[j-1] == "1" :
            ans += para[j-1][0] *100*j + para[j-1][1]
            cnt += para[j-1][0]
            
        else : pass

    if ans >= G :
        result.append(cnt)
    else :
        for j in range(D,0,-1):
            if num[j-1] == "1" : pass
            else : 
                if G <= ans + (para[j-1][0]-1)*100*(j)+ para[j-1][1]:
                    cnt += ceil((G-ans)//(100*(j)))
                    result.append(cnt) 
                
print(min(result))

Submission status: Wrong Answer

Solution code:
import math

d, g = [int(v) for v in input().split()]
#print(d, g)
pc_s = [[int(v) for v in input().split()] for _ in range(d)]
for i in range(d):
  pc = pc_s[i]
  pc_s[i].append((i + 1) * 100)
  pc_s[i].append( (pc[0] * pc[2] + pc[1]) / pc[0])
#print(pc_s)

#1問あたり得点順
pc_s = pc_s[::-1]
#1問あたりの得点＋ボーナス順
a_s = pc_s[:]
a_s.sort(key = lambda x:x[3], reverse=True)
#問題数順
cnt_s = pc_s[:]
cnt_s.sort(key = lambda x:x[0])

#print(pc_s)
#print(a_s)
solved = 0
score = 0
while score < g:
  cand_solved1 = 0
  cand_solved2 = 0
  
  #ボーナスありでクリア
  for pc in cnt_s:
    if pc[0] > 0:
      if pc[0] * pc[2] + pc[1] + score >= g:
        cand_solved1 = pc[0]
        #print("cand1={}".format(cand_solved1))
        break
  
  #ボーナスなしでクリア
  for pc in pc_s:
    #print("pc0[{}]*pc2[{}]+score[{}], g[{}]".format(pc[0], pc[2], score, g))
    if pc[0] > 0:
      if pc[0] * pc[2] + score >= g:
        cand_solved2 = math.ceil((g - score) / pc[2])
        #print("cand2={}".format(cand_solved2))
        break

  #クリアした場合はどちらを採用するか検討
  if cand_solved1 > 0 or cand_solved2 > 0:
    #print(cand_solved1, cand_solved2)
    if cand_solved1 == 0:
      num = cand_solved2
    elif cand_solved2 == 0:
      num = cand_solved1
    else:
      num = min(cand_solved1, cand_solved2)     
    score += g
    solved += num

  #高効率な問題をとく
  if score < g:
    #print("a_s", a_s)
    for pc in a_s:
      if pc[0] > 0:
        #print("最高効率:", pc)
        score += pc[0] * pc[2] + pc[1]
        solved += pc[0]
        pc[0] = 0
        break
  
print(solved)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
G /= 100
Tests = [list(map(int, input().split())) for _ in range(D)]
ans = G

for d in range(1 << D):
    g = G
    c = 0
    S = set()
    for i in range(D):
        if (d >> i) & 1:
            S.add(i)
            test = Tests[i]
            g -= (i + 1) * test[0]
            c += test[0]
            g -= test[1] // 100

    if g > 0:
        idx = set(x for x in range(D)) - S
        j = max(idx)
        test = Tests[j]
        for t in range(test[0]):
            g -= (j + 1)
            c += 1
            if g <= 0:
                ans = min(ans, c)
                break
        if t == test[0] - 1:
            g -= test[1] // 100
            if g <= 0:
                ans = min(ans, c)
    else:
        ans = min(ans, c)
                            
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
G /= 100
Tests = [list(map(int, input().split())) for _ in range(D)]
ans = G

for d in range(1 << D):
    g = G
    c = 0
    S = set()
    for i in range(D):
        if (d >> i) & 1:
            S.add(i)
            test = Tests[i]
            g -= (i + 1) * test[0]
            c += test[0]
            g -= test[1] // 100

    if g > 0:
        idx = set(x for x in range(D)) - S
        j = max(idx)
        test = Tests[j]
        for t in range(test[0]):
            g -= (j + 1)
            c += 1
            if g <= 0:
                ans = min(ans, c)
                break
        if g > 0:
            g -= test[1] // 100
            if g <= 0:
                ans = min(ans, c)
    else:
        ans = min(ans, c)
                            
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
G /= 100
Tests = [list(map(int, input().split())) for _ in range(D)]
ans = G

for d in range(1 << D):
    g = G
    c = 0
    S = set()
    for i in range(D):
        if (d >> i) & 1:
            S.add(i)
            test = Tests[i]
            g -= (i + 1) * test[0]
            c += test[0]
            g -= test[1] // 100

    if g > 0:
        idx = set(x for x in range(D)) - S
        j = max(idx)
        test = Tests[j]
        for t in range(test[0]):
            g -= (j + 1)
            c += 1
            if g <= 0:
                ans = min(ans, c)
                break
    else:
        ans = min(ans, c)
                            
print(ans)

Submission status: Wrong Answer

Solution code:
##input##
D,G = map(int,input().split())
p_c_list=[]
for i in range(D):
    p,c = map(int,input().split())
    p_c_list.append([p,c])
answer_sum = 99999
#print(p_c_list)

##syori##
for i in range(2**D):
    total = 0
    answer = 0
    moji = format(i,'b').zfill(D)
    #print(moji[D-1])
    ##total kanzen keisan
    for k in range(D):
        if int(moji[k]) == 1:
            total += (k+1)*100*p_c_list[k][0] + p_c_list[k][1]
            answer += p_c_list[k][0]
            
    if total >= G:
        if answer_sum >= answer:
            answer_sum = answer
    else:
        D_remain = moji.rfind('0')
        p_remain = int((G-total)/((D_remain+1)*100))
        if p_remain < p_c_list[D_remain][0]:
            answer += p_remain
            if answer_sum >= answer:
                answer_sum = answer
print(answer_sum)

Submission status: Wrong Answer

Solution code:
##input##
D,G = map(int,input().split())
p_c_list=[]
for i in range(D):
    p,c = map(int,input().split())
    p_c_list.append([p,c])
answer_sum = 9999
#print(p_c_list)

##syori##
for i in range(2**D):
    total = 0
    answer = 0
    moji = format(i,'b').zfill(D)
    #print(moji[D-1])
    ##total kanzen keisan
    for k in range(D):
        if int(moji[k]) == 1:
            total += (k+1)*100*p_c_list[k][0] + p_c_list[k][1]
            answer += p_c_list[k][0]
            
    if total >= G:
        if answer_sum >= answer:
            answer_sum = answer
    else:
        D_remain = moji.rfind('0')
        p_remain = int((G-total)/((D_remain+1)*100) + 0.5)
        if p_remain < p_c_list[D_remain][0]:
            answer += p_remain
            if answer_sum >= answer:
                answer_sum = answer
print(answer_sum)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
G /= 100
Tests = [list(map(int, input().split())) for _ in range(D)]
ans = G

for d in range(2**D):
    g = G
    count = 0
    B = bin(d)[2:]
    while len(B) < D:
        B = "0" + B
    for i, b in enumerate(B[::-1]):
        j = len(B) - 1 - i
        if b == "1":
            test = Tests[j]
            for t in range(test[0]):
                g -= (j + 1)
                count += 1
                if g <= 0:
                    break
            else:
                g -= test[1] // 100
            if g <= 0:
                ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
def argmax(x):
	max_value = -1000000000
	index = 0
	for i,e in enumerate(x):
		if max_value < e:
			index = i
	return i

def compute(point,prob_num,bonus_point):
	return point*prob_num + bonus_point


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

point_list=[input().split(' ') for i in range(d)]
point_list = [[int(e) for e in point] for point in point_list]
efficiency = [((i+1)*100.*point[0]+ point[1])/point[0] for i,point in enumerate(point_list)]
points = [i*100 for i in range(1,d+1)]
count = 0

while g > 0:
	index = argmax(efficiency)
	element = point_list[index]
	element_point = compute((index+1)*100,element[0],element[1])
	tmp_g = g
	if g - element_point <= -100:
		for i in range(point_list[-1][0]-1):
			tmp_g -= points[-1]*100
			if tmp_g <= 0:
				count += i+1
				print(count)
				exit()
		tmp_g -= points[-1]*100
		tmp_g -= element[1]
		count += element[0]
		if tmp_g <= 0:
			print(count)
			exit()
	elif g - element_point == 0:
		count += element[0]
		print(count)
		exit()		
	else:
		count += element[0]
		g -= element_point
		del(point_list[index])
		del(efficiency[index])
		del(points[index])
print(count)

Submission status: Wrong Answer

Solution code:
def argmax(x):
	max_value = -1000000000
	index = 0
	for i,e in enumerate(x):
		if max_value < e:
			index = i
	return i

def compute(point,prob_num,bonus_point):
	return point*prob_num + bonus_point


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

point_list=[input().split(' ') for i in range(d)]
point_list = [[int(e) for e in point] for point in point_list]
efficiency = [((i+1)*100.*point[0]+ point[1])/point[0] for i,point in enumerate(point_list)]

count = 0

while g > 0:
	index = argmax(efficiency)
	element = point_list[index]
	element_point = compute((index+1)*100,element[0],element[1])
	tmp_g = g
	if g - element_point <= -100:
		for i in range(element[0]-1):
			tmp_g -= (index+1)*100
			if tmp_g <= 0:
				count += i+1
				print(count)
				exit()
		tmp_g -= (index+1)*100
		tmp_g -= element[1]
		count += element[0]
		if tmp_g <= 0:
			print(count)
			exit()
	elif g - element_point == 0:
		count += element[0]
		print(count)
		exit()		
	else:
		count += element[0]
		g -= element_point
		del(point_list[index])
		del(efficiency[index])
print(count)

Submission status: Wrong Answer

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


def argmax(x):
	max_value = -1000000000
	index = 0
	for i,e in enumerate(x):
		if max_value < e:
			index = i
	return i

def compute(point,prob_num,bonus_point):
	return point*prob_num + bonus_point


point_list=[input().split(' ') for i in range(d)]
point_list = [[int(e) for e in point] for point in point_list]
efficiency = [((i+1)*100.*point[0]+ point[1])/point[0] for i,point in enumerate(point_list)]

count = 0

while g > 0:
	index = argmax(efficiency)
	element = point_list[index]
	element_point = compute((index+1)*100,element[0],element[1])
	tmp_g = g
	if g - element_point < -100:
		for i in range(element[0]-1):
			tmp_g -= (index+1)*100
			if tmp_g <= 0:
				count += i+1
				print(count)
				exit()
		tmp_g -= (index+1)*100
		tmp_g -= element[1]
		count += element[0]
		if tmp_g <= 0:
			print(count)
			exit()
	elif g - element_point == 0:
		count += element[0]
		print(count)
		exit()		
	else:
		count += element[0]
		g -= element_point
		del(point_list[index])
		del(efficiency[index])
print(count)

Submission status: Wrong Answer

Solution code:
from itertools import permutations

D,G = [int(i) for i in input().split()]
L = [[int(i) for i in input().split()] for _ in range(D)]

ans = []
for i in range(2**D):
    tmp = 0
    index = 0
    ans_tmp = 0
    for j in range(D):
        if (i >> j) & 1:
            tmp += L[j][0]*100*(j+1)+L[j][1]
            ans_tmp += L[j][0]
        else:
            index = j+1
    if G >= tmp:
        while G > tmp:
            ans_tmp += 1
            tmp += index*100
    ans.append(ans_tmp)

print(min(ans))

Submission status: Wrong Answer

Solution code:
import math


def main():

    num, goal = map(int, input().split())
    data = [list(map(int, input().split())) for i in range(num)]

    ans = 10 ** 10

    for i in range(2 ** num):
        toku_flg = list(map(int, list(bin(i)[2:])))
        toku_flg = [0 for i in range(num - len(toku_flg))] + toku_flg

        now_score = 0
        now_mondai = 0
        for i in range(num):
            if toku_flg[i] == 1:
                now_score += (i + 1) * 100 * data[i][0] + data[i][1]
                now_mondai += data[i][0]

        if now_score < goal:
            for i in range(num)[::-1]:
                if toku_flg[i] == 0:
                    if now_score + (i + 1) * 100 * (data[i][0] - 1) < goal:
                        break
                    nokori = goal - now_score
                    add_num = math.ceil(nokori / ((i + 1) * 100))
                    now_score += (i + 1) * 100 * add_num
                    now_mondai += add_num
                    break

        if now_score >= goal:
            if now_mondai < ans:
                ans = now_mondai
                break

    print(ans)





if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math


def main():

    num, goal = map(int, input().split())
    data = [list(map(int, input().split())) for i in range(num)]

    ans = 10 ** 10

    for i in range(2 ** num):
        toku_flg = list(map(int, list(bin(i)[2:])))
        toku_flg = [0 for i in range(num - len(toku_flg))] + toku_flg
        # toku_flg = toku_flg[::-1]

        now_score = 0
        now_mondai = 0
        for i in range(num):
            if toku_flg[i] == 1:
                now_score += (i + 1) * 100 * data[i][0] + data[i][1]
                now_mondai += data[i][0]

        if now_score < goal:
            for i in range(num)[::-1]:
                if toku_flg[i] == 0:
                    if now_score + (i + 1) * 100 * (data[i][0] - 1) < goal:
                        break
                    nokori = goal - now_score
                    add_num = math.ceil(nokori / ((i + 1) * 100))
                    now_score += (i + 1) * 100 * add_num
                    now_mondai += add_num

        if now_score >= goal:
            if now_mondai < ans:
                ans = now_mondai

    print(ans)





if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split(' '))
l = [list(map(int,input().split())) for i in range(D)]
     
ans = 10**8
for i in range(2**D):
    score = 0
    tmp = 0
    n_list = []
    for j in range(D):
        if (i >> j & 1):
            k = l[j]
            score += (j+1)*100*k[0]+k[1]
            tmp += k[0]
        else:
            n_list.append([j+1]+l[j])
    e_flag = False
    for ii in n_list[::-1]:#[1or2or..,times,bonus]
        for jj in range(ii[1]-1):
            if score<G:
                score += ii[0]*100
                tmp += 1
            else:
                e_flag = True
                break
        if e_flag:
            break
    if score<G:
        continue
    ans = min(ans,tmp)
    print(ans)

Submission status: Wrong Answer

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


def solve(D: int, G: int, p: "List[int]", c: "List[int]"):

    cpl = [ (i+1)*100*pp+cc for i,(pp,cc) in enumerate(zip(p,c)) ]

    min_n = float("inf")
    for tfl in itertools.product([True,False],repeat=D):
        cmp_total_n = sum(itertools.compress(p,tfl))
        cmp_total_p = sum(itertools.compress(cpl,tfl))
        if cmp_total_p < G:
            ntfl = [ not i for i in tfl ]
            max_i = max(itertools.compress([i for i in range(0,D)],ntfl))
            max_ip = 100*(max_i+1)

            additinal_n = (G-cmp_total_p)//max_ip
            if additinal_n < p[max_i]:
                min_n = min(min_n,cmp_total_n+additinal_n)
        else:
            min_n = min(min_n, cmp_total_n)

    print(min_n)



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

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
p,c=[],[]
ans,point=0,0

for i in range(d):
	x,y=map(int, input().split())
	p.append(x)
	c.append(y)

for i in range(len(p)-1, -1, -1):
	for j in range(p[i]):
		point += 100 * (i+1)
		ans += 1
		if g <= point: print(ans);exit()
	else:
		point += c[i]

Submission status: Wrong Answer

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

ans = 10*8
for i in range(2**D):
    score = 0
    tmp = 0
    n_list = []
    for j in range(D):
        if (i >> j & 1):
            k = l[j]
            score += (j+1)*100*k[0]+k[1]
            tmp += k[0]
        else:
            n_list.append([j+1]+l[j])
    e_flag = False
    for ii in n_list[::-1]:#[1or2or..,times,bonus]
        for jj in range(ii[1]):
            if score<G:
                score += ii[0]*100
                tmp += 1
            else:
                e_flag = True
                break
        if e_flag:
            break
    if score<G:
        continue
    ans = min(ans,tmp)
print(ans)

Submission status: Wrong Answer

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

ans = 10*8
for i in range(2**D):
    score = 0
    tmp = 0
    n_list = []
    for j in range(D):
        if (i >> j & 1):
            k = l[j]
            score += (j+1)*100*k[0]+k[1]
            tmp += k[0]
        else:
            n_list.append([j+1]+l[j])
    e_flag = False
    for ii in n_list[::-1]:#[1or2or..,times,bonus]
        for jj in range(ii[1]-1):
            if score<G:
                score += ii[0]*100
                tmp += 1
            else:
                e_flag = True
                break
        if e_flag:
            break
    if score<G:
        continue
    ans = min(ans,tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
d,g = (int(i) for i in input().split())
def judge(l,r):
    if l[1]>=g and r[1]>=g:
        print(min(l[0],r[0]))
        exit()
    if l[1]>=g:
        print(l[0])
        exit()
    else:
        print(r[0])
        exit()

e = [[int(i) for i in input().split()] for i in range(d)]
l = [0,0]
r = [0,0] #p,c
for i in range(len(e)):
    l_tmp = e[i]
    r_tmp = e[d-i-1]
    for j in range(1,max(l_tmp[0]+1,r_tmp[0]+1)):
        if j<=l_tmp[0]:
            l[0] += 1
            l[1] += 100*(i+1)
            if j==l_tmp[0]:
                l[1]+=l_tmp[1]

        if j<=r_tmp[0]:
            r[0] += 1
            r[1] += 100*(d-i)
            if j==r_tmp[0]:
                r[1]+=r_tmp[1]

        if l[1]>=g or r[1]>=g:
            judge(l,r)

Submission status: Wrong Answer

Solution code:
d,g = (int(i) for i in input().split())
def judge(l,r):
    if l[1]>=g and r[1]>=g:
        print(min(l[0],r[0]))
        exit()
    if l[1]>=g:
        print(l[0])
        exit()
    else:
        print(r[0])
        exit()

e = [[int(i) for i in input().split()] for i in range(d)]
l = [0,0]
r = [0,0] #p,c
for i in range(len(e)):
    l_tmp = e[i]
    r_tmp = e[d-i-1]
    for j in range(1,max(l_tmp[0]+1,r_tmp[0]+1)):
        if j<=l_tmp[0]:
            l[0] += 1
            l[1] += 100*(i+1)
        if j<=r_tmp[0]:
            r[0] += 1
            r[1] += 100*(d-i)
        if l[1]>=g or r[1]>=g:
            judge(l,r)
    l[1]+=l_tmp[1]
    r[1]+=r_tmp[1]
    if l[1]>=g or r[1]>=g:
        judge(l,r)

Submission status: Wrong Answer

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

G /= 100
l = [[0]*3 for i in range(D)]

for i in range(D):
    p, c = list(map(int, input().split()))
    l[i][0] = i+1
    l[i][1] = p
    l[i][2] = c/100


def dfs(i, scores):
    if scores <= 0:
        return 0

    if i == D:
        return 1e9

    a, p, b = l[i]

    counts = [1e9]*(p+1)
    for j in reversed(range(p+1)):
        if j == p and scores-a*p - b >= 0:
            counts[j] = dfs(i+1, scores-a*p-b) + p
        elif scores-a*j >= 0:
            counts[j] = dfs(i+1, scores-a*j) + j
        else:
            break

    ans = min(counts)
    return ans


ans = dfs(0, G)

print(ans)

Submission status: Wrong Answer

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

G /= 100
l = [[0]*3 for i in range(D)]

for i in range(D):
    p, c = list(map(int, input().split()))
    l[i][0] = i+1
    l[i][1] = p
    l[i][2] = c/100


def dfs(i, scores):
    if scores <= 0:
        return 0

    if i == D:
        return 1e9

    a, p, b = l[i]

    counts = [1e9]*(p+1)
    for j in reversed(range(p+1)):
        if j == p:
            counts[j] = dfs(i+1, scores-a*p-b) + p
        elif scores-a*j >= 0:
            counts[j] = dfs(i+1, scores-a*j) + j
        else:
            break

    ans = min(counts)
    return ans


ans = dfs(0, G)

print(ans)

Submission status: Wrong Answer

Solution code:
N,G = map(int, input().split())
l = []
for i in range(N):
    a,b = map(int, input().split())
    l.append((a,b,i+1))
l.reverse()
num = 0
for i in range(N):
    a,b,c = l[i]
    if a*100*c + b <= G:
        num += a
        G -= a*100*c + b
    else:
        break
a,b,c = l[i]
num+= G//(c*100)
print(num)

Submission status: Wrong Answer

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

# def up_f(i,score):
# 	if i == D+1:
# 		return 10**9
# 	n = min(score//(i*100),PC[i-1][0])
# 	s = n*100*i
# 	s += PC[i-1][1] if n == PC[i-1][0] else 0
# 	if s < score:
# 		n += up_f(i+1,score-s)
# 	return min(n,up_f(i+1,t))

def down_f(i,score):
	if i == 0:
		return 10**9
	n = min(score//(i*100),PC[i-1][0])
	s = n*100*i
	s += PC[i-1][1] if n == PC[i-1][0] else 0
	if s < score:
		n += down_f(i-1,score-s)
	return min(n,down_f(i-1,G))

# print(min(up_f(1,G),down_f(D,G)))
print(down_f(D,G))

Submission status: Wrong Answer

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

def up_f(i,score):
	if i == D+1:
		return 10**9
	n = min(score//(i*100),PC[i-1][0])
	s = n*100*i
	s += PC[i-1][1] if n == PC[i-1][0] else 0
	if s < score:
		n += up_f(i+1,score-s)
	return min(n,up_f(i+1,G))

def down_f(i,score):
	if i == 0:
		return 10**9
	n = min(score//(i*100),PC[i-1][0])
	s = n*100*i
	s += PC[i-1][1] if n == PC[i-1][0] else 0
	if s < score:
		n += down_f(i-1,score-s)
	return min(n,down_f(i-1,G))

print(min(up_f(1,G),down_f(D,G)))

Submission status: Wrong Answer

Solution code:
def ceil(n): # ceiling関数
    if n > int(n):
        return(int(n)+1)
    else:
        return(int(n))
from operator import itemgetter
D,G = map(int,input().split())
p = []
c = []
for i in range(D):
    pi,ci = map(int,input().split())
    p.append(pi)
    c.append(ci)

comp_ed = [[i,(i+1)*100*p[i]+c[i],((i+1)*100*p[i]+c[i])/p[i]] for i in range(D)]
comp_ed.sort(key=itemgetter(2),reverse=True)
now = 0
used = [i for i in range(D)]
ans = 0
for i in range(D):
    if now+comp_ed[i][1] > G:
        ans += ceil((G-now)/((max(used)+1)*100))
        break
    else:
        
        now += comp_ed[i][1]
        ans += p[comp_ed[i][0]]
        used[comp_ed[i][0]] = -1

print(ans)

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
D,G = map(int,input().split())
p = []
c = []
for i in range(D):
    pi,ci = map(int,input().split())
    p.append(pi)
    c.append(ci)

comp_ed = [[i,(i+1)*100*p[i]+c[i],((i+1)*100*p[i]+c[i])/p[i]] for i in range(D)]
comp_ed.sort(key=itemgetter(2),reverse=True)
now = 0
used = [i for i in range(D)]
ans = 0
for i in range(D):
    if now+comp_ed[i][1] > G:
        ans += (G-now)//((max(used)+1)*100)
        break
    else:
        
        now += comp_ed[i][1]
        ans += p[comp_ed[i][0]]
        used[comp_ed[i][0]] = -1

print(ans)