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:
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]

pc2 = [((p*100*(i+1)+c)/p, i, p, c, ((p*100*(i+1)+c)))
       for (i, (p, c)) in enumerate(pc)]

pc2.reverse()

rest = g
ans = 0

while rest > 0:
    # print(pc2)
    if pc2[0][4] <= rest:
        rest -= pc2[0][4]
        ans += pc2[0][2]
        del pc2[0]
    else:
        prob = 10**30
        point = 0
        for _, i, p, c, _ in pc2:
            x = 100*(i+1)
            num = (rest+99)//x
            if num * p >= point and prob > num:
                prob = num
                point = num*p
        ans += prob
        rest -= point
        break


# print(rest)

print(ans)

Submission status: Wrong Answer

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

# 目標700点
D, G = getNM()
query = []
for i in range(D):
    p, c = getNM()
    query.append([i + 1, p, c])
N = len(query)

query.sort(key = lambda i: i[0])

cnt = 0
while G > 0:
    # 最大火力
    max_opt = -1
    for i in range(N - 1, -1, -1):
        if query[i][1] != 0:
            max_opt = i
            break

    sin_fire = query[max_opt][0] * 100
    time = min(query[max_opt][1], (G + sin_fire - 1) // sin_fire)
    max_fire = time * query[max_opt][0] * 100

    for j in range(N):
        if i == j or query[j][1] == 0:
            continue
        p = query[j][1] * query[j][0] * 100 + query[j][2]
        if p >= min(G, max_fire) and query[j][1] <= time:
            max_opt = j
            time = query[j][1]
            break

    G -= time * query[max_opt][0] * 100
    cnt += time
    query[max_opt][1] -= time
    if query[max_opt][1] == 0:
        G -= query[max_opt][2]

print(cnt)

Submission status: Wrong Answer

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

ans =  float('inf')


for bit in range(1 << D ):
    sum = 0
    count = 0
    nokori = set(range(1, D + 1))

    for i in range(D):
        # if bit & (1 << D)で、bitにiが含まれているか（フラグが立っているか）を判定してくれるらしい
        #今回は、i×100点の問題を全て解く場合の処理を書く
        if bit & (1 << i):
            sum +=  100 * (i + 1) * pi[i] + ci[i]
            count += pi[i]
            nokori.discard(i + 1)

    if (sum < G ):
        use = max(nokori)
        n = min(pi[use-1], (G- sum )// (use * 100)  )
        count += n
        sum   += n * 100 * use 

    if  (sum >= G):
        ans = min(count, ans)

print(ans)

Submission status: Wrong Answer

Solution code:
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = -(-(g - sum) // (use * 100))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100\
            + pc[i][1], count + pc[i][0], nokori - {i + 1})


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

ans = 10

dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)

Submission status: Wrong Answer

Solution code:
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = min(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count) 
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100\
        + pc[i][1], count + pc[i][0], nokori - {i + 1})


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

ans = float("inf")

dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)

Submission status: Wrong Answer

Solution code:
# まだ解いてない配点を nokori として持つ
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = count
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100\
         + pc[i][1], count + pc[i][0], nokori - {i + 1})


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

ans = 0

dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    d,g = map(int,input().split())
    pc = [list(map(int, input().split())) for _ in range(d)]
    ans = 10**9
    for i in range(2**d):
        count = 0
        total = 0
        nokori = [1 for _ in range(d)]
        for j in range(d):
            if (i>>j & 1):
                total += pc[j][0] * (j+1)* 100 + pc[j][1]
                count += pc[j][0]
                nokori[j] = 0
        if total >= g:
            ans = min(ans, count)
        else:
            for k in reversed(range(len(nokori))):
                if nokori[k] == 0:
                    continue
                else:
                    if total + (pc[k][0]-1) * (k+1) *100 >= g:
                        count += ((g-total) - (k+1)*100)//((k+1)*100) + 1
                        ans = min(ans, count)
                        break
                    else:
                        total += (pc[k][0]-1) * (k+1) *100
                        count += (pc[k][1]-1)
    print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
import math
D,G=map(int,input().split())
PC=[list(map(int,input().split())) for i in range(D)]
zenkan=[]
def saiki(A):
    if len(A)==D:
        ans=0
        count=0
        toita=[]
        for i in range(D):
            if A[i]==1:
                ans+=PC[i][0]*(i+1)*100+PC[i][1]
                count+=PC[i][0]
                toita.append(i)
        zenkan.append([ans,count,toita])
        return ans
    for i in range(2):
        A.append(i)
        saiki(A)
        A.pop()
saiki([])
ans=[]
zenkan.sort()
for i in range(len(zenkan)):
    cost=zenkan[i][1]
    hituyo=G-zenkan[i][0]
    if zenkan[i][0]>=G:
        ans.append(cost)
        continue
    cost_kari=[]
    for j in range(D):
        if j not in zenkan[i][2]:
            cost_kari.append(math.ceil(hituyo/(100*(j+1))))
            #print(math.ceil(hituyo/100*(j+1)),j)
    ans.append(cost+min(cost_kari))
    #print(cost_kari)
#print(zenkan)
#print(ans)
print(min(ans))

Submission status: Wrong Answer

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

import math
ans = float('inf')
for i in range(1 << d):
    point = 0
    solved = 0

    for j in range(d):
        if (i >> j) & 1:
            point += pc[j][1] + pc[j][0] * 100 * (j + 1)
            solved += pc[j][0]

    f = False
    for j in reversed(range(d)):
        if not ((i >> j) & 1):
            if point + (j + 1) * 100 * (pc[j][0] - 1) >= g:
                _solved = max(0, math.ceil((g - point) / ((j + 1) * 100)))
                solved += _solved
                point += _solved * 100 * (j + 1)
                f = True
                break
            else:
                _solved = pc[j][0] - 1
                solved += _solved
                point += _solved * 100 * (j + 1)

    if f:
        ans = min(ans, solved)

print(ans)

Submission status: Wrong Answer

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

ans=float("inf")
for bit in range(1<<d):
    count=0;
    sum=0;
    nokori=set(range(1,d+1))
    for i in range(d):
        if bit&(1<<i):
            sum+=p[i][0]*(i+1)*100+p[i][1]
            count+=p[i][0]
            nokori.discard(i+1)
    if sum>=g:
        ans=min(ans,count)
    else:
        use=max(nokori)
        n=min(p[use-1][0],math.ceil((g-sum)//(100*use)))
        count+=n
        sum+=n*use*100
        if sum>=g:
            ans=min(ans,count)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product
import math

D, G = map(int, input().split()) 
ipcl = []
for i in range(D):
    p, c = map(int, input().split()) 
    ipcl.append( [i+1, p, c] )

pattern = 2
ite = product(range(pattern),repeat=D)

ans = 10**5
for comb in ite:
    print('-^---')

    curr_ipcl = ipcl[:]
    curr_sum = 0
    curr_prob = 0
    for i, comp in enumerate(comb):
        if comp:
            pi, p,c = ipcl[i]
            curr_sum += (i+1)*p*100
            curr_sum += c
            curr_prob += p
            curr_ipcl[i] = [pi,0,0]
    
    for ipc in reversed(curr_ipcl):
        i,p,c = ipc
        if curr_sum + p*i*100 <= G:
            curr_sum += p*i*100
            curr_prob += p
        else:
            remain = max(0, G-curr_sum)
            curr_prob += math.ceil( remain/(i*100) )
            break

    ans = min(ans, curr_prob)


print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product
import math

D, G = map(int, input().split()) 
ipcl = []
for i in range(D):
    p, c = map(int, input().split()) 
    ipcl.append( [i+1, p, c] )

pattern = 2
ite = product(range(pattern),repeat=D)

ans = 10**5
for comb in ite:
    curr_ipcl = ipcl[:]
    curr_sum = 0
    curr_prob = 0
    for i, comp in enumerate(comb):
        if comp:
            pi, p,c = ipcl[i]
            curr_sum += (i+1)*p*100
            curr_sum += c
            curr_prob += p
            curr_ipcl[i] = [pi,0,0]
    
    for ipc in reversed(curr_ipcl):
        i,p,c = ipc
        if curr_sum + p*i*100 <= G:
            curr_sum += p*i*100
            curr_prob += p
        else:
            remain = max(0, G-curr_sum)
            curr_prob += math.ceil( remain/(i*100) )

    ans = min(ans, curr_prob)

print(ans)

Submission status: Wrong Answer

Solution code:
N, G = map(int, input().split())
bonus = []
problems = []
for _ in range(N):
    PI, CI = map(int, input().split())
    problems.append(PI)
    bonus.append(CI)


def calc_rest_score():
    total = 0
    for i, pi in enumerate(problems):
        if pi:
            score = (i+1) * 100
            total += score * pi + bonus[i]
    return total


def make_plan(total_problem, total_score, flag):
    """
    :param total_score: ここまでの合計スコア
    :param total_problem: ここまでの合計問題数
    :param flag: 最後のスコア調整実施済みフラグ
    :return: 合計問題数
    """
    if total_score >= G:
        return total_problem

    # print("call ", total_problem, total_score, problems)

    rest_score = calc_rest_score()  # 残り全部解いたら何点になるのか
    if total_score + rest_score < G:
        # もう無理
        return 10000

    for i in range(N - 1, -1, -1):
        pi = problems[i]
        si = (i + 1) * 100
        if pi == 0:
            continue
        else:
            # 1. 全部解く
            problems[i] = 0
            pn1 = make_plan(total_problem + pi,
                            total_score + si * pi + bonus[i],
                            flag)
            problems[i] = pi
            # print("pn1:", pn1)

            # 2. 部分的に解く(ただし最後の調整として)
            if not flag:
                # 1問ずつ減らして結果を比較
                min_pn = 10000  # 多分問題数はmaxでも5500問くらい
                for j in range(pi, -1, -1):  # 1～(pi-1)
                    plus_score = si * j
                    if j == pi:
                        plus_score += bonus[i]
                    problems[i] = 0
                    pn = make_plan(total_problem+j,
                                   total_score+plus_score,
                                   True)
                    # print("test", j, pn)
                    problems[i] = pi
                    if pn < min_pn:
                        min_pn = pn
                pn2 = min_pn
            else:
                pn2 = 10000

            return min(pn1, pn2)
    else:
        # 問題を避けすぎて解けない
        return 10000


print(make_plan(0, 0, False))

Submission status: Wrong Answer

Solution code:
N, G = map(int, input().split())
bonus = []
problems = []
for _ in range(N):
    PI, CI = map(int, input().split())
    problems.append(PI)
    bonus.append(CI)


def calc_rest_score():
    total = 0
    for i, pi in enumerate(problems):
        if pi:
            score = (i+1) * 100
            total += score * pi + bonus[i]
    return total


def make_plan(total_problem, total_score):
    """
    :param i: 問題ランク(0～N-1)
    :param total_score: ここまでの合計スコア
    :param total_problem: ここまでの合計問題数
    :param problems: 残り問題数のリスト
    :return: 合計スコア, 合計問題数
    """
    # 残っている中で、一番単体点数が高い問題を選ぶ
    rest_score = calc_rest_score()  # 残り全部解いたら何点になるのか
    if total_score + rest_score < G:
        # もう無理
        return 0, 10000

    # print(total_problem, total_score, problems)
    for i in range(N - 1, -1, -1):
        pi = problems[i]
        si = (i + 1) * 100
        if pi == 0:
            continue
        else:
            if total_score + pi * si >= G:
                # ボーナスなしでもゴールに達成できる状態
                # そのままゴールする
                score = total_score
                pn = total_problem
                while score < G:
                    pn += 1
                    score += si
                # print("goal")
                return score, pn
            else:
                # 1問ずつ減らして結果を比較
                min_pn = 10000  # 多分問題数はmaxでも5500問くらい
                cand_score = 0
                for j in range(pi+1, 0, -1):
                    # print("test", j)
                    plus_score = si * j
                    if j == pi:
                        plus_score += bonus[i]
                    problems[i] = 0
                    score, pn = make_plan(total_problem+j, total_score+plus_score)  # 次の計画
                    problems[i] = pi
                    if pn < min_pn:
                        min_pn = pn
                        cand_score = score
                    if total_score + plus_score >= G:
                        break
                return cand_score, min_pn
    else:
        # 問題を避けすぎて解けない
        return 0, 10000


print(make_plan(0, 0)[1])

Submission status: Wrong Answer

Solution code:
N, G = map(int, input().split())
bonus = []
problems = []
for _ in range(N):
    PI, CI = map(int, input().split())
    problems.append(PI)
    bonus.append(CI)


def make_plan(total_problem, total_score, problems):
    """
    :param i: 問題ランク(0～N-1)
    :param total_score: ここまでの合計スコア
    :param total_problem: ここまでの合計問題数
    :param problems: 残り問題数のリスト
    :return: 合計スコア, 合計問題数
    """
    # 残っている中で、一番単体点数が高い問題を選ぶ
    for i in range(N - 1, -1, -1):
        pi = problems[i]
        si = (i + 1) * 100
        if pi == 0:
            continue
        else:
            if total_score + pi * si >= G:
                # ボーナスなしでもゴールに達成できる状態
                # そのままゴールする
                score = total_score
                pn = total_problem
                while score < G:
                    pn += 1
                    score += si
                return score, pn
            else:
                # 1問ずつ増やして結果を比較
                min_pn = 10000  # 多分問題数はmaxでも5500問くらい
                cand_score = 0
                for j in range(1, pi+1):
                    plus_score = si * j
                    if j == pi:
                        plus_score += bonus[i]
                    problems[i] = 0
                    score, pn = make_plan(total_problem+j, total_score+plus_score, problems)  # 次の計画
                    problems[i] = pi
                    if pn < min_pn:
                        min_pn = pn
                        cand_score = score
                    if total_score + plus_score >= G:
                        break
                return cand_score, min_pn
    else:
        # 問題を避けすぎて解けない
        return 0, 10000


print(make_plan(0, 0, problems))

Submission status: Wrong Answer

Solution code:
from itertools import product

d, g = map(int, input().split())
prob = []
for i in range(1, d + 1):
    p, c = map(int, input().split())
    prob.append((i * 100, p, c))  # score, num, bonus

ans = 1000000000
# repeatは
for prd in product([0, 1], repeat=d):
    cnt = 0
    allScore = 0
    for j, (score, num, bonus) in zip(prd, prob):
        if j == 1:
            cnt += num
            allScore += score * num + bonus

    if allScore < g:
        for j, (score, num, bonus) in zip(prd, prob):
            if j == 0 and (score * num >= g - allScore):
                rest = (g - allScore) // score
                cnt += rest
                allScore += score * rest
                break

        if allScore >= g:
            ans = min(ans, cnt)

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())
  
x = 10**3
INF = 10**10
dp = [[INF]*(g//100+x) for _ in range(d+1)]
dp[0][0]=0

for i in range(1,d+1):
  for k in range(g//100+x):
      dp[i][k] = min(dp[i][k],dp[i-1][k])
  
      for j in range(P[i-1]):    
        q = j+1
        score = q*i        
        if q == P[i-1]:
          score += C[i-1]//100    
    
        if k - score >= 0:
          dp[i][k] = min(dp[i][k],dp[i-1][k-score]+q)      
        
print(min(dp[-1][g//100:]))

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())
  
x = 10**4
INF = 10**2
dp = [[INF]*(g//100+x) for _ in range(d+1)]
dp[0][0]=0

for i in range(1,d+1):
  for j in range(P[i-1]):
    
    q = j+1
    score = q*i    
    
    if q == P[i-1]:
      score += C[i-1]//100
    #print(i,j,P[i-1],score)
    for k in range(g//100+x):
      dp[i][k] = min(dp[i][k],dp[i-1][k])
      if k - score >= 0:
        dp[i][k] = min(dp[i][k],dp[i-1][k-score]+q)      
        
print(min(dp[-1][g//100:]))

Submission status: Wrong Answer

Solution code:
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
def c(i,t,l):
    if i==d:
        if t>=g:
            return sum(l)
        else:
            m=d-l[::-1].index(0)
            e = -(t - g) // (m * 100)
            if e < s[m-1][0]:
                return sum(l)+e
            else:
                return 10**3
    return min(c(i+1,t,l+[0]),c(i+1,t+s[i][0]*-~i*100+s[i][1],l+[s[i][0]]))
print(c(0,0,[]))

Submission status: Wrong Answer

Solution code:
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
s = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]
a = 10**3
for b in range(1 << d):
    su = sum(s[i][0] * (b >> i & 1) for i in range(d))
    n = sum(s[i][1] * (b >> i & 1) for i in range(d))
    if su < g:
        m = d-bin(b)[2:].zfill(d).find("0")
        e = -(su-g)//(m*100)
        if e < s[m-1][1]:
            a = min(a,n + e)
    if su >= g:
        a = min(a,n)
print(a)

Submission status: Wrong Answer

Solution code:
(d, g), *s = [list(map(int, i.split())) for i in open(0)]
s = [[i[0] * -~n * 100 + i[1], i[0]] for n, i in enumerate(s)]
a = 10**3
for b in range(1 << d):
    su = sum(s[i][0] * (b >> i & 1) for i in range(d))
    n = sum(s[i][1] * (b >> i & 1) for i in range(d))
    if su < g:
        m = d-bin(b)[2:].zfill(d).find("0")
        e =-~(g-su)//(m*100)
        
        if e < s[m-1][1]:
            a = min(a,n + e)
    if su >= g:
        a = min(a,n)
print(a)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
res = [list(map(int, input().split())) for _ in range(d)]
ans = float('inf')
for i in range(d**2):
    point = 0
    problem = 0
    for j in range(d):
        if (i >> j) & 1:
            point += res[j][1] + (j +1)*100*res[j][0]
            problem += res[j][0]
    if point >= g:
        ans = min(ans, problem)
    else:
        for k in range(d-1, -1, -1):
            if not (i>>k) & 1:
                for j in range(res[k][0]):
                    point += 100*(k+1)
                    problem += 1
                    if point >= g:
                        ans = min(ans, problem)
                        break
        
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
num_bonus = [list(map(int, input().split())) for _ in range(d)]
all_num = 0


for i in range(d):
    all_num += num_bonus[i][0]

num_bonus.reverse()
score = 0
cnt = 0
p_i = d

for i in range(d):

    for j in range(num_bonus[i][0]):
        cnt += 1
        score += 100 * p_i
        if score >= g:
            print(cnt)
            exit(0)

    score += num_bonus[i][1]
    p_i -= 1

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
P,C = [],[]
for i in range(1, d+1):
    p,c = map(int,input().split())
    P.append(p)
    C.append(c)
ans = 10**9
for bin in range(1, 1<<d):
    cnt = tot = 0
    for j in range(d):
        if bin & 1<<j:
            cnt += P[j]
            tot += P[j]*(j+1)*100 + C[j]
    for j in range(d):
        if bin & 1<<j:
            now_cnt = cnt
            now_tot = tot - C[j]
            for k in range(P[j]):
                now_cnt -= 1
                now_tot -= (j+1)*100
                if now_tot >= g: ans = min(ans, now_cnt)
print(ans)

Submission status: Wrong Answer

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

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

ans = 1e9
for i in range(2 ** d):
    sum_ = 0
    num = 0
    rest_max = -1
    for j in range(d):
        if ((i >> j) & 1):
            sum_ += 100 * (j + 1) * p[j] + c[j]
            num += p[j]
        else:
            rest_max = j
    if (sum_ < g):
        s1 = 100 * (rest_max + 1)
        need = (g - sum_ + s1 - 1) / s1
        if need >= p[rest_max]:
            continue
        num += need
    ans = min(ans, num)
print(ans)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
p=[]
c=[]
avg=[]
for i in range(D):
  p1,c1=map(int,input().split())
  p.append(p1)
  c.append(c1)
  avg.append((p1*(i+1)*100+c1)/p1)
ans=sum(p)
for i in range(2**D):
  num=0
  point=0
  sit=[0]*D
  for j in range(D):
    if(i>>j&1):
      num+=p[j]
      sit[j]+=p[j]
      point+=(j+1)*100*p[j]+c[j]
  if(point<G):
    sitt=sit[::-1]
    loc=D-1-sitt.index(0)
    k=0
    while(point<G):
      num+=1
      k+=1
      point+=(loc+1)*100
    if(k<p[loc]):
      ans=min(ans,num)
  #print(loc)
print(ans)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
questions = [list(map(int,input().split())) for _ in range(D)]
ans = float('inf')
for bit in range(1,1 << D):
  count = 0
  score = 0
  max_zero_index = 0
  for i in range(D):
    if (bit >> i) & 1:
      score += questions[i][0]*100*(i+1)+questions[i][1]
      count += questions[i][0]
    else:
      max_zero_index = i
  if score >= G:
    ans = min(count,ans)
  else:
    for _ in range(1,questions[max_zero_index][0]):
      count +=1
      score += 100*(max_zero_index+1)
      if score >= G:
        ans = min(count,ans)
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
P = [0] * D
C = [0] * D
ans = float("inf")

for i in range(D):
    P[i], C[i] = map(int, input().split())

for bit in range(1 << D):
    score = 0
    cnt = 0
    unused = set(range(1, D+1))
    for i in range(D):
        if (bit >> i) & 1 == 1:
            cnt += P[i]
            score += 100 * (i + 1) * P[i] + C[i]
            unused.discard(i + 1)

    if score < G:
        use = max(unused)
        num = min(P[use - 1], (G - score) // (use * 100))
        cnt += num
        score += use * 100 * num

    if score >= G:
        ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

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

ans=10**9
for i in range(d):
    p[i],c[i]=map(int,input().split())
for i in range(2**d):
    score=0
    cnt=0
    com=0
    for j in range(d):
        if ((i >> j) & 1):
            score+=100*(j+1)*p[j]+c[j]
            cnt+=p[j]
            com=j
 
    flg=0
    if score>=g:
        while p[com]>flg:
            score-=100*(com+1)
            if flg==0:
                score-=c[com]
            if score<g:
                break
            else:
                flg+=1

        cnt-=flg
        if ans>cnt:
            ans=cnt
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

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

    # 昇順での探索だよ
    for i in range(2 ** D):
        checked = [False]*D
        pnt = 0
        cnt = 0

        for j in range(D):  # このループが一番のポイント
            if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
                pnt += C[j]
                pnt += P[j]*(j+1)*100
                checked[j] = True
                cnt += P[j]
        if pnt < G:
            for k in reversed(range(D)):
                if not checked[k]:
                    prob_cnt = 0
                    br_fl = False

                    while prob_cnt < P[k]-1:
                        pnt += (k+1)*100
                        cnt += 1
                        prob_cnt += 1
                        if pnt >= G:
                            br_fl = True
                            break
                    if br_fl:
                        break
            if pnt >= G:
                ans = min(ans, cnt)

    print(ans)


resolve()

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
problems = [[int(s) for s in input().split()] for _ in range(D)]

result = 10 ** 8

for i in range(2 ** D):
    cnt_problem = 0
    cnt_score = 0
    for j in range(D):
        if i << j:
            cnt_score += problems[j][1] + 100 * (j + 1) * problems[j][0]
            cnt_problem += problems[j][0]

    for j in reversed(range(D)):
        if not i << j:
            for k in range(1, problems[j][0]):
                if cnt_score >= G:
                    break
                else:
                    cnt_score += problems[j][1]
                    cnt_problem += 1
    result = min(cnt_problem, result)

print(result)

Submission status: Wrong Answer

Solution code:
import math
d, g = map(int, input().split())
p = [0 for _ in range(d+1)]
c = [0 for _ in range(d+1)]
ans = 10 ** 10
for i in range(d):
    pi, ci = map(int, input().split())
    p[i+1] = pi
    c[i+1] = ci     
for bit in range ( 1 << d):
    score = 0
    cnt = 0
    tokanai_saidai = 0
    for i in range(d):
        if bit & (1 << i):
            score += p[i+1] * 100 * (i+1) + c[i+1]
            cnt += p[i+1]
        else:
            tokanai_saidai = i + 1
    if score > g:
        if cnt < ans:
            ans = cnt
    else:
        nokori_score = g - score
        if nokori_score < 100 * (tokanai_saidai) * p[tokanai_saidai]:
            cnt += math.ceil(nokori_score / (100 * tokanai_saidai))
            if cnt < ans:
                ans = cnt 
print(ans)