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:
from math import ceil

D,G=map(int,input().split())
p=[]
c=[]
m=10**10
for i in range(D):
    pi,ci=map(int,input().split())
    p.append(pi)
    c.append(ci)
N=bin(2**D)[2:]
for i in range(2**D):
    k=bin(i)[2:].zfill(D)
    num=0
    g=0
    for j in range(D):
        if k[j]==1:
            num+=p[j]
            g+=p[j]*(j+1)*100+c[j]
        else:
            sub=j
    if G-g<0:
        m=min(m,num)
        continue
    if ceil((G-g)/((sub+1)*100))>=p[j]:
        continue
    num+=int(ceil((G-g)/((sub+1)*100)))
    m=min(m,num)
print(m)

Submission status: Wrong Answer

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

#G点のために、

answer = 1e10

from itertools import product

for x in product([0,1], repeat=D):
  #print(x)
  
  temp_score = 0 
  temp_q = 0
  rest = None
  
  for i, _x in enumerate(x):
    if _x:
      temp_score += (i+1)*100*PC[i][0] + PC[i][1]
      temp_q += PC[i][0]
    else:
      rest = i
  #print(temp_score, temp_q, rest)
  if temp_score >= G:
    answer = min(answer, temp_q)
  
  if temp_score < G and (G-temp_score) < PC[i][0] * (100*(rest+1)):
    answer = min(answer, temp_q + (G-temp_score)//(100*(rest+1)) + bool((G-temp_score)%(100*(rest+1))))
    

print(answer)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p = [0] * d
c = [0] * d
ans = 1000000000000
for i in range(d):
    p[i], c[i] = map(int, input().split())

for i in range(2**d):
    sum = 0
    num = 0
    for j in range(d):
        if i & (1 << j):
            sum += c[j]+p[j]*100*(j+1)
            num += p[j]
    if sum >= g:
        ans = min(ans, num)
    else:
        for j in range(d-1, 0, -1):
            if i & (1 << j):
                continue
            for k in range(p[j]):
                if sum >= g:
                    break
                sum += 100*(j+1)
                num += 1
        ans = min(ans, num)
print(ans)

Submission status: Wrong Answer

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

ans = 1e9
for i in range(1 << D):
  point = 0
  cnt = 0
  for j in range(D):
    if (i >> j)& 1:
      point += PC[j][0]*(j+1)*100+PC[j][1]
      cnt += PC[j][0]
    else:
      tmp = j
  if point < G:
    R = G-point
    if (PC[tmp][0]-1)*(tmp+1)*100 < R:
      continue
    cnt += R//(100*(tmp+1))
  ans = min(ans, cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
D, G = (int(i) for i in input().split()) 
p_c = [[int(i) for i in input().split()] for i in range(D)] 
#p_c = [[3,500],[5,800]]

CNT = []

for i in range(1 << len(p_c)):
	score = 0
	counter = [0] * D
#	print("i:", i)
#	print("bin:", bin(i))
	for j in range(len(p_c)):
#		print(" j:", j)
		if (i >> j) & 1 == 1:
#			print(p_c[j][1])
			score += p_c[j][1]
			score += 100 * i * p_c[j][0]
			counter[j] += p_c[j][0]

	if G <= score:
#		print("OK")
#		print("score:", score)
#		print("counter:", counter)
		CNT.append(sum(counter))

	else:
#		print("counter:" ,counter)
		for k in reversed(range(D)):
#			print("   k:", k)
			if (i >> k) & 1 != 1:
				for l in range(p_c[k][0]):
#					print("   l:", l)
					counter[k] += 1
					score += 100 * (k+1)
					if G <= score:
#						print("OK")
#						print("score:", score)
#						print("counter:", counter)
						CNT.append(sum(counter))

						break

			if G <= score:
				break

#	print("\n")
print(min(CNT))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
D, G = (int(i) for i in input().split()) 
p_c = [[int(i) for i in input().split()] for i in range(D)] 
#p_c = [[3,500],[5,800]]

CNT = []

for i in range(1 << len(p_c)):
	score = 0
	counter = [0] * D
	print("i:", i)
	print("bin:", bin(i))
	for j in range(len(p_c)):
		print(" j:", j)
		if (i >> j) & 1 == 1:
			print(p_c[j][1])
			score += p_c[j][1]
			score += 100 * i * p_c[j][0]
			counter[j] += p_c[j][0]

	if G <= score:
		print("OK")
		print("score:", score)
		print("counter:", counter)
		CNT.append(sum(counter))

	else:
		print("counter:" ,counter)
		for k in reversed(range(D)):
			print("   k:", k)
			if (i >> k) & 1 != 1:
				for l in range(p_c[k][0]):
					print("   l:", l)
					counter[k] += 1
					score += 100 * (k+1)
					if G <= score:
						print("OK")
						print("score:", score)
						print("counter:", counter)
						CNT.append(sum(counter))

						break

			if G <= score:
				break

	print("\n")
print(min(CNT))

Submission status: Wrong Answer

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

# 100*(i+1) 点の問題を完全に解くか？
import itertools
do_solves = list(itertools.product([True, False], repeat=D))

import math
best_solve_count = 10*9
for do_solve in do_solves:
    count = 0
    point = 0
    # 完全に解く問題の合計点数, 合計問題数を計算
    for i, solve in enumerate(do_solve):
        if solve:
            point += (100 * (i+1) * pcd[i][0]) + pcd[i][1]
            count += pcd[i][0]
    if point >= G:
        # 完全に解く問題だけで必要な点数を超えている
        if count < best_solve_count:
            best_solve_count = count
    else:
        # 完全に解く問題だけでは必要な点数に満たない
        #  -> 完全に解かない問題のうち, 最も高い得点の問題を一部必要な数だけ解く
        for i in range(D-1, -1, -1):
            if not do_solve[i]:
                need_solve_count = math.ceil((G - point) / (100 * (i+1)))
                if need_solve_count < pcd[i][0]:
                    count += need_solve_count
                    if count < best_solve_count:
                        best_solve_count = count
print(best_solve_count)

Submission status: Wrong Answer

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

# 100*(i+1) 点の問題を完全に解くか？
import itertools
do_solves = list(itertools.product([True, False], repeat=D))

import math
best_solve_count = 10*9
for do_solve in do_solves:
    count = 0
    point = 0
    for i, solve in enumerate(do_solve):
        if solve:
            point += (100 * (i+1) * pcd[i][0]) + pcd[i][1]
            count += pcd[i][0]
    if point >= G:
        # 完全に解く問題だけで必要な点数を超えている
        if count < best_solve_count:
            best_solve_count = count
    else:
        # 完全に解く問題だけでは必要な点数に満たない
        #  -> 完全に解かない問題のうち, 最も高い得点の問題を一部必要な数だけ解く
        for i in range(D-1, -1, -1):
            if not do_solve[i]:
                break
        need_solve_count = math.ceil((G - point) / (100 * (i+1)))
        if need_solve_count < pcd[i][0]:
            count += need_solve_count
            if count < best_solve_count:
                best_solve_count = count
print(best_solve_count)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
answer = 0
Q = []
for i in range(d):
    p,c=map(int,input().split())
    answer += p
    Q.append((i+1,p,c))
print(answer)

dp = [-10**9]*(answer+1) 
dp[0] = 0
for i,p,c in Q:
    for j in range(answer,-1,-1):
        for k in range(1,p+1):
            cc = i*100*k
            if k == p:
                cc += c
            if j-k >= 0:
                dp[j]=max(dp[j],dp[j-k]+cc)
        
for i in range(answer+1):
    if dp[i] >= g:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
import sys
d,g=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost,flag):
  if x==len(l):
    return 10**18
  num1=num+l[x][0]*100*(x+1)+l[x][1]
  cost1=cost+l[x][0]
  flag1=flag|(2**x)
  cost3=dfs(x+1,num1,cost1,flag1)
  num2=num
  cost2=cost
  flag2=flag
  cost4=dfs(x+1,num2,cost2,flag2)
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag1>0:
      continue
    if num1>=g:
      break
    if (g-num1+i*100-1)//(i*100)<l[i-1][0]:
      cost1+=(g-num1+i*100-1)//(i*100)
      num1+=((g-num1+i*100-1)//(i*100))*100*i
      break
    else:
      num1+=l[i-1][0]*100*i+l[i-1][1]
      cost1+=l[i-1][0]
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag2>0:
      continue
    if num2>=g:
      break
    if (g-num2+i*100-1)//(i*100)<l[i-1][0]:
      cost2+=(g-num+i*100-1)//(i*100)
      num2+=((g-num1+i*100-1)//(i*100))*100*i
      break
    else:
      num2+=l[i-1][0]*100*i+l[i-1][1]
      cost2+=l[i-1][0]
  if num1<g:
    cost1=10**18
  if num2<g:
    cost2=10**18
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(dfs(0,0,0,0))

Submission status: Wrong Answer

Solution code:
import sys
d,g=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost,flag):
  if x==len(l):
    return 10**18
  num1=num+l[x][0]*100*(x+1)+l[x][1]
  cost1=cost+l[x][0]
  flag1=flag|(2**x)
  cost3=dfs(x+1,num1,cost1,flag1)
  num2=num
  cost2=cost
  flag2=flag
  cost4=dfs(x+1,cost2,num2,flag2)
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag1>0:
      continue
    if num1>=g:
      break
    if (g-num1+i*100-1)//(i*100)<=l[i-1][0]:
      cost1+=(g-num1+i*100-1)//(i*100)
      break
    else:
      num1+=l[i-1][0]*100*i+l[i-1][1]
      cost1+=l[i-1][0]
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag2>0:
      continue
    if num2>=g:
      break
    if (g-num2+i*100-1)//(i*100)<=l[i-1][0]:
      cost2+=(g-num+i*100-1)//(i*100)
      break
    else:
      num2+=l[i-1][0]*100*i+l[i-1][1]
      cost2+=l[i-1][0]
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(dfs(0,0,0,0))

Submission status: Wrong Answer

Solution code:
import sys
d,g=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost,flag):
  if x==len(l):
    return 10**18
  num1=num+l[x][0]*100*(x+1)+l[x][1]
  cost1=cost+l[x][0]
  flag1=flag|(2**x)
  cost3=dfs(x+1,num1,cost1,flag1)
  num2=num
  cost2=cost
  flag2=flag
  cost4=dfs(x+1,cost2,num2,flag2)
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag1>0:
      continue
    if num1>=g:
      break
    if (g-num1+i*100-1)//(i*100)<=l[i-1][0]:
      cost1+=max(0,(g-num1+i*100-1)//(i*100))
      break
    else:
      num1+=l[i-1][0]*100*i+l[i-1][1]
      cost1+=l[i-1][0]
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag2>0:
      continue
    if num2>=g:
      break
    if (g-num2+i*100-1)//(i*100)<=l[i-1][0]:
      cost2+=max(0,(g-num+i*100-1)//(i*100))
      break
    else:
      num2+=l[i-1][0]*100*i+l[i-1][1]
      cost2+=l[i-1][0]
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(dfs(0,0,0,0))

Submission status: Wrong Answer

Solution code:
import sys
d,g=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost,flag):
  if x==len(l):
    return 10**18
  num1=num+l[x][0]*100*(x+1)+l[x][1]
  cost1=cost+l[x][0]
  flag1=flag|2**x
  cost3=dfs(x+1,num1,cost1,flag1)
  num2=num
  cost2=cost
  flag2=flag
  cost4=dfs(x+1,cost2,num2,flag2)
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag1>0:
      continue
    if num>=g:
      break
    if (g-num1+i*100-1)//(i*100)<=l[i-1][0]:
      cost1+=max(0,(g-num1+i*100-1)//(i*100))
      break
    else:
      num1+=l[i-1][0]*100*i+l[i-1][1]
      cost1+=l[i-1][0]
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag2>0:
      continue
    if num>=g:
      break
    if (g-num2+i*100-1)//(i*100)<=l[i-1][0]:
      cost2+=max(0,(g-num+i*100-1)//(i*100))
      break
    else:
      num2+=l[i-1][0]*100*i+l[i-1][1]
      cost2+=l[i-1][0]
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(dfs(0,0,0,0))

Submission status: Wrong Answer

Solution code:
import sys
d,g=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost,flag):
  if x==len(l):
    return 10**18
  num1=num+l[x][0]*100*(x+1)+l[x][1]
  cost1=cost+l[x][0]
  flag1=flag|2**x
  cost3=dfs(x+1,num1,cost1,flag1)
  num2=num
  cost2=cost
  flag2=flag
  cost4=dfs(x+1,cost2,num2,flag2)
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag1>0:
      continue
    if (g-num1+i*100-1)//(i*100)<=l[i-1][0]:
      cost1+=max(0,(g-num1+i*100-1)//(i*100))
      break
    else:
      num1+=l[i-1][0]*100*i+l[i-1][1]
      cost1+=l[i-1][0]
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag2>0:
      continue
    if (g-num2+i*100-1)//(i*100)<=l[i-1][0]:
      cost2+=max(0,(g-num+i*100-1)//(i*100))
      break
    else:
      num2+=l[i-1][0]*100*i+l[i-1][1]
      cost2+=l[i-1][0]
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(dfs(0,0,0,0))

Submission status: Wrong Answer

Solution code:
import sys
d,g=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost,flag):
  if x==len(l):
    return 10**18
  num1=num+l[x][0]*100*(x+1)+l[x][1]
  cost1=cost+l[x][0]
  flag1=flag|2**x
  cost3=dfs(x+1,num1,cost1,flag1)
  num2=num
  cost2=cost
  flag2=flag
  cost4=dfs(x+1,cost2,num2,flag2)
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag1>0:
      continue
    if (g-num1+i*100-1)//(i*100)<=l[i-1][0]:
      cost1+=max(0,(g-num1+i*100-1)//(i*100))
      break
    else:
      num1+=l[i-1][0]*100*i
      cost1+=l[i-1][0]
  for i in range(len(l),0,-1):
    if 2**(i-1)&flag2>0:
      continue
    if (g-num2+i*100-1)//(i*100)<=l[i-1][0]:
      cost2+=max(0,(g-num+i*100-1)//(i*100))
      break
    else:
      num2+=l[i-1][0]*100*i
      cost2+=l[i-1][0]
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(dfs(0,0,0,0))

Submission status: Wrong Answer

Solution code:
import sys
d,g=map(int,input().split())
l=[[int(i) for i in l.split()] for l in sys.stdin]
def dfs(x,num,cost):
  if x==len(l):
    return 10**18
  num1+=l[x][0]*100*(x+1)+l[x][1]
  cost1+=l[x][0]
  cost3=dfs(x+1,num1,cost1)
  num2=num
  cost2=cost
  cost4=dfs(x+1,num2,cost2)
  for i in range(len(n),0,-1):
    if (g-num1+i*100-1)//(i*100)<=l[x][0]:
      cost1+=(g-num1+i*100-1)//(i*100)
      break
  for i in range(len(n),0,-1):
    if (g-num2+i*100-1)//(i*100)<=l[x][0]:
      cost2+=(g-num+i*100-1)//(i*100)
      break
  cost=min(cost1,cost2,cost3,cost4)
  return cost
print(0,0,0)

Submission status: Wrong Answer

Solution code:
# WA, something wrong when checked a04, a16
import math

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


min_num_solved = 1000000000000000000000
for canditate in range(1 << D):
    num_solved = 0
    score = 0
    digit_m1_list = []
    # digit_m1 means digit - 1
    d_range = range(D)
    for digit_m1 in d_range:
        # If all problems were solved
        if (canditate >> digit_m1) & 1:
            digit = digit_m1 + 1
            score += \
                (100 * digit) * p_c_list[digit_m1][0] + p_c_list[digit_m1][1]
            num_solved += p_c_list[digit_m1][0]
            digit_m1_list.append(digit_m1)
    # print('digit_m1: ', digit_m1_list, 'score: ', score, 'n_solved: ', num_solved)

    # If the score did not reach the (G)oal point
    if score < G:
        left_point = G - score
        left_probrems_idxes_m1 = \
            [i for i in reversed(d_range) if i not in digit_m1_list]
        # Calcurate How many probrems you should solve
        # Constraint: 100 * (left_probrems_idx_m1 + 1) * x >= left_point
        # ->  x >= left_point / (100 * (left_probrems_idx_m1 + 1))
        for left_probrems_idx_m1 in left_probrems_idxes_m1:
            x = math.ceil(left_point / (100 * (left_probrems_idx_m1 + 1)))
            # p_c_list[left_probrems_idx_m1][0] : Total probrems in the idx
            num_solved += min(p_c_list[left_probrems_idx_m1][0], x)
            left_point -= (100 * (left_probrems_idx_m1 + 1)) * num_solved
            if left_point <= 0:
                # print('if you additionally solved probrems -> n_solved: ', num_solved)
                break
    min_num_solved = min(min_num_solved, num_solved)

print(min_num_solved)

Submission status: Wrong Answer

Solution code:
import math

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


min_num_solved = 10000000000000
for canditate in range(1 << D):
    num_solved = 0
    score = 0
    digit_m1_list = []
    # digit_m1 means digit - 1
    d_range = range(D)
    for digit_m1 in d_range:
        # If all problems were solved
        if (canditate >> digit_m1) & 1:
            digit = digit_m1 + 1
            score += \
                (100 * digit) * p_c_list[digit_m1][0] + p_c_list[digit_m1][1]
            num_solved += p_c_list[digit_m1][0]
            digit_m1_list.append(digit_m1)
    # print('digit_m1: ', digit_m1_list, 'score: ', score, 'n_solved: ', num_solved)

    # If the score did not reach the (G)oal point
    if score < G:
        left_point = G - score
        left_probrems_idxes_m1 = \
            [i for i in reversed(d_range) if i not in digit_m1_list]
        # Calcurate How many probrems you should solve
        # Constraint: 100 * (left_probrems_idx_m1 + 1) * x >= left_point
        # ->  x >= left_point / (100 * (left_probrems_idx_m1 + 1))
        for left_probrems_idx_m1 in left_probrems_idxes_m1:
            x = math.ceil(left_point / (100 * (left_probrems_idx_m1 + 1)))
            # p_c_list[left_probrems_idx_m1][0] : Total probrems in the idx
            num_solved += min(p_c_list[left_probrems_idx_m1][0], x)
            left_point -= (100 * (left_probrems_idx_m1 + 1)) * num_solved
            if left_point <= 0:
                # print('if you additionally solved probrems -> n_solved: ', num_solved)
                break
    min_num_solved = min(min_num_solved, num_solved)

print(min_num_solved)

Submission status: Wrong Answer

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

def solve(g,i):
    if i<=0:
        return float('inf')
    n = min(int(g/100*i),PC[i-1][0])
    score = 100 * i * n
    if n == PC[i-1][0]:
        score += PC[i-1][1]
    if g > score:
        n += solve(g-score,i-1)
    return min(n,solve(g,i-1))

print(solve(g,d))

Submission status: Wrong Answer

Solution code:
import math
d, g = map(int, input().split())
questions = [list(map(int, input().split())) for _ in range(d)]
ans = 10**9

for i in range(2**d):
    score = 0
    problems = 0
    resindex = -1  # 完全に解いた問題以外で最も点数が高い問題
    for j in range(d):
        # print(i, j)
        # print(i >> j & 1)
        if i >> j & 1 == 1:
            # 完全にj+1問目を解いた時の合計点数
            score += (j+1)*100*questions[j][0] + questions[j][1]
            problems += questions[j][0]
        else:
            resindex = j
    # 完全に解いた問題だけで，目標点数を超えた場合
    if g <= score:
        ans = min(ans, problems)
    # 完全に解いた問題以外で最も点数が高い問題を全て解いて
    # 目標点を超える場合（ボーナス点は考慮しない）
    elif 0 <= resindex \
            and g <= score + questions[resindex][0]*(resindex+1)*100:
        # problems += -(-(g-score) // ((resindex+1)*100))
        problems += math.ceil((g-score) // ((resindex+1)*100))
        ans = min(ans, problems)

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
 
def main():
	D, G = map(int, input().split(" "))
	
	score_board = []
	all_bms = []
	for i in range(D):
		a, b = map(int, input().split(" "))
		score_board.append(((i+1) * 100, a, b))
		all_bms.append((a, ((i+1) * 100 * a) + b))
	
	ans = 100000000000000000000000000000000
	for i in range(2 ** D):
		total_turn = 0
		total_points = 0
		tmp = -1
		for j in range(D):
			if i >> j & 1 == 1:
				turn, points = all_bms[j]
				total_turn += turn
				total_points += points
				
			if i >> j & 1 == 0 and tmp < j:
				tmp = j
				
		if G <= total_points:
			if ans > total_turn:
				ans = total_turn
		else:
			ten, a, b = score_board[tmp]
			if (G - total_points) // ten < a:
				if ans > total_turn + ((G - total_points) // ten):
					ans = total_turn + ((G - total_points) // ten)
	
	print(ans)
		
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys

def main():
	D, G = map(int, input().split(" "))
	
	score_board = []
	all_bms = []
	for i in range(D):
		a, b = map(int, input().split(" "))
		score_board.append(((i+1) * 100, a, b))
		all_bms.append((a, ((i+1) * 100 * a) + b))
	
	ans = 1000000
	for i in range(2 ** D):
		total_turn = 0
		total_points = 0
		tmp = -1
		for j in range(D):
			if i >> j & 1 == 1:
				turn, points = all_bms[j]
				total_turn += turn
				total_points += points
				
			if i >> j & 1 == 0 and tmp < j:
				tmp = j
				
		if G <= total_points:
			if ans > total_turn:
				ans = total_turn
		else:
			ten, a, b = score_board[tmp]
			if (G - total_points) // ten < a:
				if ans > total_turn + ((G - total_points) // ten):
					ans = total_turn + ((G - total_points) // ten)
	
	print(ans)
		
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
p, c = [], []
for _ in range(D):
    inp = list(map(int, input().split()))
    p.append(inp[0])
    c.append(inp[1])
#n = [list(map(int, input().split())) for _ in range(D)]

#最大で10のレベル、１００問が存在するので可能な組み合わせは101^10
#複数のレベルを中途半端にとく場合は、レベルの高い方の問題をもう一問解くことでスコアが必ず上がるので
#「中途半端にとく」配点は一つまで。その他は完全荷解き切るか、全くとかない。
ans = 10 * 100
for i in range(2 ** D):
    #i番めの問題を完全に解いた時
    score = 0
    solved = [0] * D
    for j in range(D):
        if (i >> j) & 1:
            solved[j] = 1
    #まず完全に解いた問題レベルに対して基本てんとボーナスをえる。
    for s in range(len(solved)):
        if solved[s]:
            score += 100 * (i+1) * p[s] + c[s]
    #この時の問題数がansより小さければ更新し、次のiteration
    num = sum([pi * solvedi for pi, solvedi in zip(p, solved)])
    if score >= G:
        if num < ans:
            ans = num
            continue
        else:
            continue
    #scoreがまだ足りなければ、残っている中でもっともレベルの高い問題を解いていく   
    solved = [str(i) for i in solved]
    to_solve = ''.join(solved).rindex('0')
    for k in range(p[to_solve]):
        score += 100 * (to_solve + 1)
        num += 1
        if score >= G:
            break
    if num < ans:
        ans = num
        
print(ans)

Submission status: Wrong Answer

Solution code:
D , G = map(int,input().split())
PC = [ list(map(int,input().split())) for _ in range(D)]
ans = 10 ** 6
# コンプリートボーナスを取る組み合わせを網羅するための２進数表現
for bit in range(2 ** D -1):
    tempG = G
    tempcount = 0
    for i in range(D):
        # ２進数bitのi桁目が1であれば
        if (bit>>i)&1 == 1:
            # i番目を使い切ってコンプリートボーナスを取る
            tempG -= (100 * (i+1)*PC[i][0] + PC[i][1])
            tempcount += PC[i][0]
    # コンプリートのみでの場合
    if tempG <= 0:
        ans = min(ans, tempcount)
    # 残りはコンプリートなしで考える
    else:
        # 点数が大きな方から使う
        for j in range(D)[::-1]:
            # 使わなかったものの中で最も点数が大きな問題を使う
            if (bit>>j)&1 == 0: 
                for k in range(PC[j][0]):
                    if (tempG - 100 * (j+1) * k) <= 0:
                        ans = min(ans , tempcount +k)
                        tempcount += k
                        continue

print(ans)

Submission status: Wrong Answer

Solution code:
D , G = map(int,input().split())
PC = [ list(map(int,input().split())) for _ in range(D)]
ans = 10 ** 6
# コンプリートボーナスを取る組み合わせを網羅するための２進数表現
for bit in range(2 ** D -1):
    tempG = G
    tempcount = 0
    for i in range(D):
        # ２進数bitのi桁目が1であれば
        if (bit>>i)&1 == 1:
            # i番目を使い切ってコンプリートボーナスを取る
            tempG -= (100 * (i+1)*PC[i][0] + PC[i][1])
            tempcount += PC[i][0]
    # コンプリートのみでの場合
    if tempG <= 0:
        ans = min(ans, tempcount)
    # 残りはコンプリートなしで考える
    else:
        # 点数が大きな方から使う
        for j in range(D)[::-1]:
            # 使わなかったものの中で最も点数が大きな問題を使う
            if (bit>>j)&1 == 0: 
                for k in range(PC[j][0]):
                    if (tempG - 100 * (j+1) * k) <= 0:
                        ans = min(ans , tempcount +k)
                        continue

print(ans)

Submission status: Wrong Answer

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

# 計算しやすいよう100で割る
G = G // 100
q_count = 0
for c in Ci:
    c[1] = c[1] // 100
    q_count += c[0]

dp = [dict() for _ in range(D + 1)]

for d in dp:
    d[0] = 0

min_count = 1000000
for i, c in enumerate(Ci):
    d1 = dp[i]
    d2 = dp[i + 1]
    for k, v in d1.items():
        for j in range(1, c[0] + 1):
            s = v + (i + 1) * j
            if j == c[0]:
                s += c[1]
            k2 = k + j
            if k2 in d2:
                d2[k2] = max(d2[k2], s)
            else:
                d2[k2] = s
            if s >= G:
                if k + j < min_count:
                    min_count = k + j
                break
print(min_count)

Submission status: Wrong Answer

Solution code:
D, G = [int(i) for i in input().split()]
p = c = []
for i in range(D):
  x, y = [int(j) for j in input().split()]
  p.append(x)
  c.append(y)

c_ave = []
for i in range(D):
  c_ave.append([(100 * i * p[i] + c[i])/p[i], i])

c_ave_sort = sorted(c_ave, key=lambda c_ave: c_ave[0], reverse=True)

total = num = 0
for i in range(D):
  n = c_ave_sort[i][1]
  if total + 100 * n * (p[n] - 1) >= G:
    num += int((G - total)/(100 * n)) + 1
    break
  else:
    total += 100 * n * p[n] + c[n]
    num += p[n]
    if (total >= G):
      break

print(num)

Submission status: Wrong Answer

Solution code:
D, G = [int(i) for i in input().split()]
p = c = []
for i in range(D):
  x, y = [int(j) for j in input().split()]
  p.append(x)
  c.append(y)

c_ave = []
for i in range(D):
  c_ave.append([(100 * i * p[i] + c[i])/p[i], i])

c_ave_sort = sorted(c_ave, key=lambda c_ave: c_ave[0], reverse=True)

total = num = 0
for i in range(D):
  n = c_ave_sort[i][1]
  if total + 100 * n * (p[n] - 1) >= G:
    num += int((G - total)/(100 * n)) + 1
    break
  else:
    total += 100 * n * p[n] + c[n]
    num += p[n]

print(num)

Submission status: Wrong Answer

Solution code:
D, G = [int(i) for i in input().split()]
p = c = []
for i in range(D):
  x, y = [int(j) for j in input().split()]
  p.append(x)
  c.append(y)

c_ave = []
for i in range(D):
  c_ave.append([(100 * i * p[i] + c[i])/p[i], p[i]])

c_ave_sort = sorted(c_ave, key=lambda c_ave: c_ave[0], reverse=True)

total = num = 0
for i in range(D):
  if total + 100 * i * (p[i] - 1) > G:
    num += int((G - total)/(100 * i)) + 1
    break
  else:
    total += 100 * i * p[i] + c[i]
    num += p[i]

print(num)

Submission status: Wrong Answer

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

def dfs(g, i):
  if(i == 0):
    return 1e9

  x = min(G//(100*i), PC[i][0])
  point = x*100*i

  if(x == PC[i][0]):
    point += PC[i][1]
  
  if(g > point):
    x += dfs(g-point, i-1)
  
  return min(x, dfs(g, i-1))
print(dfs(G, D))

Submission status: Wrong Answer

Solution code:
from math import ceil


def solve(string):
    d, g, *pc = map(int, string.split())
    g //= 100
    p = [_p for _p in pc[::2]]
    c = [_c // 100 for _c in pc[1::2]]
    ans = []
    eff_comp = [((_p * (i + 1) + _c) / _p, i + 1, _p, _c) for i, (_p, _c) in enumerate(zip(p, c))]
    eff_incomp = [(i + 1, i + 1, _p - 1, 0) for i, (_p, _c) in enumerate(zip(p, c))]

    eff = sorted(eff_comp + eff_incomp, reverse=True)
    tmp = 0
    used = []
    for _e, _i, _p, _c in eff:
        if _i in used:
            continue
        if _e * _p < g:
            g -= _i * _p + _c
            tmp += _p
            used.append(_i)
            continue
        if _c == 0:
            ans.append(tmp + (ceil(g / _e)))
        else:
            ans.append(tmp + _p)
    return str(min(ans))


if __name__ == '__main__':
    n, g = map(int, input().split())
    print(solve('{} {}\n'.format(n, g) + '\n'.join([input() for _ in range(n)])))

Submission status: Wrong Answer

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

ans = float('inf')
for i in range(2**D):
    pnt = 0
    cnt = 0
    for j in range(D):
        if ((i >> j) % 2 == 1):
            pnt += p[j]*100*(j+1)+c[j]
            cnt += p[j]
        else:
            unsolved = j
    if pnt >= G:
        ans = min(ans,cnt)
    elif pnt + (p[unsolved]-1)*100*(unsolved+1) >= G:
        tmp = (G-pnt)//(100*(unsolved+1))
        ans = min(ans,cnt+tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

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

sump = [0]*D
i = 1
for p,c in pc:
	sump[i-1] = [p*i*100+c,i]
	i += 1

data = []
for i in range(1 << len(sump)):
	num = 0
	s = ""
	for j in range(len(sump)):
		if ((i >> j) & 1) == 1:
			num += sump[j][0]
			s += str(j)
	else:
		data.append([num,s])
		continue

ans = MAX_INT
for j in data:
	cnt = 0
	for sss in j[1]:
		if sss[0] != 0:
			cnt += pc[int(sss)][0]

	num = j[0]
	for i in range(D-1,-1,-1):
		if str(i) not in j[1]:
			for k in range(pc[i][0]):
				if num >= G:
					ans = min(ans,cnt)
					break
				else:
					num += (i+1)*100
					cnt += 1
					if num >= G:
						ans = min(ans,cnt)
						break
			break

print(ans)