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())
P = []
C = []
for i in range(D):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)


def bit_search(A):
    result = []
    for i in range(1 << len(A)):
        output = []
        for j in range(len(A)):
            if ((i >> j) & 1) == 1:
                output.append(A[j])
        result.append(output)

    return result


search_list = bit_search(list(range(D)))
ans = 10 * 9
for complete_list in search_list:
    score = sum([100 * (i + 1) * P[i] + C[i] for i in complete_list])
    count = sum([P[i] for i in complete_list])
    j = D - 1
    while score < G and j >= 0:
        if j not in complete_list:
            required = -(-(G - score) // (100 * (j + 1)))
            if required < P[j]:
                count += required
                score += required * 100 * (j + 1)
            else:
                break
        j -= 1
    if score >= G:
        ans = min(ans, count)
print(ans)

Submission status: Wrong Answer

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


def bit_search(A):
    result = []
    for i in range(1 << len(A)):
        output = []
        for j in range(len(A)):
            if ((i >> j) & 1) == 1:
                output.append(A[j])
        result.append(output)

    return result


search_list = bit_search(list(range(D)))
ans = 10 * 9
for complete_list in search_list:
    score = sum([100 * (i + 1) * P[i] + C[i] for i in complete_list])
    count = sum([P[i] for i in complete_list])
    j = D - 1
    while score < G and j >= 0:
        if j not in complete_list:
            required = -(-(G - score) // (100 * (j + 1)))
            count += min(P[j] - 1, required)
            score += min(P[j] - 1, required) * 100 * (j + 1)
        j -= 1
    if score >= G:
        ans = min(ans, count)
print(ans)

Submission status: Wrong Answer

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

import itertools

D, G = map(int, input().split())
ps, cs = [], []
for _ in range(D):
    p, c = map(int, input().split())
    ps.append(p)
    cs.append(c)

cps = list(itertools.product([True, False], repeat=D))
cps.pop(0) # Remove True all

ans = sum(ps)
for cp in cps:
    point, qs, maxp = 0, 0, 0
    for i in range(D):
        if cp[i]:
            point += (i + 1) * 100 * ps[i] + cs[i]
            qs += ps[i]
        else:
            maxp = i
    if point + (maxp + 1) * 100 * (ps[maxp] - 1) >= G:
        mq = max(0, int((G - point) / ((maxp + 1) * 100)))
        ans = min(ans, qs + mq)

print(ans)

Submission status: Wrong Answer

Solution code:
D,G = list(map(int,input().split()))
P = []
C = []

for i in range(D):
    p,c = list(map(int,input().split()))
    P.append(p)
    C.append(c)

ans = 10000

for c in range(2**D):
    score = 0
    solved = 0
    remain = []
    for i,b in enumerate(format(c,'b').zfill(D)):
        if b == '1':
            score += P[i]*100*(i+1) + C[i]
            solved += P[i]
        else:
            remain.append(i)
    if score < G:
        R = G - score
        j = remain[-1]
        if (P[j]-1)*(j+1)*100 < R:
            continue
        solved += (R//(100*(j+1)))
    ans = min(solved, ans)

print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    D, G = map(int, input().split())
    pc = []
    for i in range(D):
        p, c = map(int, input().split())
        w = 100 * (i + 1)
        y = w * p + c
        z = y / p
        pc.append((p, w, y, z))
    pc = sorted(pc, key=lambda x: x[3], reverse=True)
    ans = 0
    for p, w, y, z in pc:
        if G >= y:
            G -= y
            ans += p
        else:
            for _ in range(p):
                if G == 0:
                    print(ans)
                    exit()
                G -= w
                ans += 1


main()

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
L = []
for i in range(1, D+1):
    p, c = map(int, input().split())
    L.append([i, p, c])
L.sort(key=lambda x: (100*x[0]*x[1]+x[2])/x[1], reverse=True)
num = 0
for j in range(D):
    if G > 100*L[j][0]*L[j][1]+L[j][2]:
        G -= 100*L[j][0]*L[j][1]+L[j][2]
        num += L[j][1]
        L[j] = [0, 0, 0]
    else:
        break
tmp_num = 10000
for k in range(j, D):
    if G <= 100*L[k][0]*L[k][1]+L[k][2]:
        tmp_num = min(tmp_num, L[k][1])
L.sort(key=lambda x: x[0], reverse=True)
tmp_num = min(tmp_num, math.ceil(G/(100*L[0][0])))
print(num + tmp_num)

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
L = []
for i in range(1, D+1):
    p, c = map(int, input().split())
    L.append([i, p, c])
L.sort(key=lambda x: (100*x[0]*x[1]+x[2])/x[1], reverse=True)
num = 0
for j in range(D):
    if G > 100*L[j][0]*L[j][1]+L[j][2]:
        G -= 100*L[j][0]*L[j][1]+L[j][2]
        num += L[j][1]
        L[j] = [0, 0, 0]
    else:
        tmp_num = L[j][1]
        break
L.sort(key=lambda x: x[0], reverse=True)
tmp_num = min(tmp_num, math.ceil(G/(100*L[0][0])))
print(num + tmp_num)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
L = []
for i in range(1, D+1):
    p, c = map(int, input().split())
    L.append([i, p, c])
L.sort(key=lambda x: (100*x[0]*x[1]+x[2])/x[1], reverse=True)
num = 0
for j in range(D):
    if G > 100*L[j][0]*L[j][1]+L[j][2]:
        G -= 100*L[j][0]*L[j][1]+L[j][2]
        num += L[j][1]
        L[j] = [0, 0, 0]
    else:
        num1 = L[j][1]
        break
num2 = 0
M = L.sort(key=lambda x: x[0], reverse=True)



print(num + num1)

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
L = []
for i in range(1, D+1):
    p, c = map(int, input().split())
    L.append([i, p, c, 100*i*p, 100*i*p+c, (100*i*p+c)/p])
L.sort(key=lambda x: x[-1], reverse=True)
num = 0
for j in range(D):
    if G > L[j][4]:
        G -= L[j][4]
        num += L[j][1]
        L[j] = [0, 0, 0, 0, 0]
    else:
        break
num1, num2 = 100000, 100000
for k in range(j, D):
    if G <= L[k][4]:
        num1 = min(num1, L[k][1])
    if G <= L[k][3]:
        num2 = min(num2, math.ceil(G/(100*L[k][0])))
num += min(num1, num2)
print(num)

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
L = []
for i in range(1, D+1):
    p, c = map(int, input().split())
    L.append([i, p, c, 100*i*p, 100*i*p+c, (100*i*p+c)/p])
L.sort(key=lambda x: x[-1], reverse=True)
num = 0
for j in range(D):
    if G > L[j][4]:
        G -= L[j][4]
        num += L[j][1]
        L[j] = [0, 0, 0, 0, 0]
        print(L)
    else:
        break
num1, num2 = 100000, 100000
for k in range(j, D):
    if G <= L[k][4]:
        num1 = min(num1, L[k][1])
    if G <= L[k][3]:
        num2 = min(num2, math.ceil(G/(100*L[k][0])))
num += min(num1, num2)
print(num)

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
L = []
for i in range(1, D+1):
    p, c = map(int, input().split())
    L.append([i, p, c, 100*i*p, 100*i*p+c, (100*i*p+c)/p])
L.sort(key=lambda x: x[-1], reverse=True)
num = 0
for j in range(D):
    if G > L[j][4]:
        G -= L[j][4]
        num += L[j][1]
        L[j][1:] = [0, 0, 0, 0, 0]
    else:
        num1, num2 = 100000, 100000
        if G <= L[j][4]:
            num1 = min(num1, L[j][1])
        if G <= L[j][3]:
            num2 = min(num2, math.ceil(G/(100*L[j][0])))
num += min(num1, num2)
print(num)

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
L = []
for i in range(D):
    p, c = map(int, input().split())
    L.append([i, p, c, 100*i*p, 100*i*p+c, (100*i*p+c)/p])
L.sort(key=lambda x: x[-1], reverse=True)
# print(L)
num = 0
for j in range(D):
    if G > L[j][4]:
        G -= L[j][4]
        num += L[j][1]
        L[j][1:] = [0, 0, 0, 0, 0]
    else:
        num1 = L[j][1]
        M = L[:]
        M.sort(key=lambda x: x[0], reverse=True)
        num2 = 100000
        for k in range(D):
            if M[k][3] >= G:
                num2 = math.ceil(G/(100*M[k][0]))
                break
        num += min(num1, num2)
        break
print(num)

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
L = []
for i in range(D):
    p, c = map(int, input().split())
    L.append([i, p, c, 100*i*p, 100*i*p+c, (100*i*p+c)/p])
L.sort(key=lambda x: x[-1], reverse=True)
# print(L)
num = 0
for j in range(D):
    if G > L[j][4]:
        G -= L[j][4]
        num += L[j][1]
        L[j][1:] = [0, 0, 0, 0, 0]
    else:
        num1 = L[j][1]
        M = L[:]
        M.sort(key=lambda x: x[0], reverse=True)
        num2 = 100000
        for k in range(D):
            if M[k][3] >= G:
                num2 = math.ceil(G/(100*M[k][0]))
        num += min(num1, num2)
        break
print(num)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
L = []
for i in range(D):
    p, c = map(int, input().split())
    L.append([i, p, c, 100*p+c, (100*p+c)/p])
L.sort(key=lambda x: x[-1], reverse=True)
# print(L)
num = 0
for j in range(D):
    # if G > L[j][3]:
    G -= L[j][3]
    num += L[j][1]
    L[j][1:] = [0, 0, 0, 0]
    if G <= 0:
        break
print(num)

Submission status: Wrong Answer

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

complete=[None]*d
for i in range(d):
  complete[i] = info[i][0]*(100*i+100) + info[i][1]
  #print(complete[i])

ans = 1000

for i in range(1,2**(d)):
  bin_i = str("0"*(d+2-len(bin(i)))+str(bin(i))[2:])
  #print(bin_i)
  
  summation=0
  count=0
  index_0=-1
  
  for j in range(d):
    if bin_i[j]=="1":
      summation += complete[j]
      count +=info[j][0]
    else:
      index_0 = j
      
  if summation >= g:
    ans = min(ans,count)
  elif summation < g:
    tmp_g = g
    for j in range(info[index_0][0]):
      tmp_g = tmp_g-100*(index_0+1)
      count +=1
      if summation >= tmp_g:
        ans = min(ans,count)
        break
  #print(ans)
  
print(ans)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


d, g = LI()
contest = [LI() for _ in range(d)]

ans = INF

# Bit全探索
for bit in range(1 << d):
    score = 0
    cnt = 0
    remain_max = -1

    # 各bitが立っているか確認
    for i in range(d):
        if bit >> i & 1:
            score += contest[i][0] * (i + 1) * 100 + contest[i][1]
            cnt += contest[i][0]
            continue
        # コンプリートしなかった問題の中で最も得点の高い問題をメモ
        remain_max = i

    if score >= g:
        ans = min(ans, cnt)
        continue

    need = (g - score) // 100 // (remain_max + 1)

    if need >= contest[remain_max][0]:
        continue

    ans = min(ans, cnt + need)

print(ans)

Submission status: Wrong Answer

Solution code:
import math as m
D,G = map(int, input().split())
info = [list(map(int, input().split())) for i in range(D)]
def bfs(list_hoge=[[0,[]]],depth=0):
    queue = []
    for e in list_hoge:
        for b in [0,1]:
            if b == 0:
                score = e[0]
                copy = e[1][:]
                queue.append([score,copy])
            elif b == 1:
                score = e[0] + 100*(depth+1)*info[depth][0] + info[depth][1]
                copy = e[1][:]
                copy.append(depth)
                queue.append([score,copy])
    list_hoge = queue[:]
    if depth == len(info)-1:
        return list_hoge
    return bfs(list_hoge,depth+1)
res = bfs()
ans = float("inf")
for e in res:
    solved = 0
    for i in range(len(e[1])):
        solved += info[e[1][i]][0]
    print(solved)
    if e[0] >= G:
        if solved < ans:
            ans = solved
        continue
    for i in range(D-1,-1,-1):
        if not i in e[1]:
            nec = G-e[0]
            haiten = 100*(i+1)
            add_solve = m.ceil(nec/haiten)
            total_solved = solved + m.ceil(nec/haiten)
            if add_solve >= info[i][0]:
                break
            if total_solved < ans:
                ans = total_solved
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
d,g=[int(x) for x in input().split()]
p,c=[],[]
for _ in [0]*d:
    pi,ci=[int(x) for x in input().split()]
    p.append(pi)
    c.append(ci)
from itertools import product
ans=1<<10
for tip in product(*[range(i+1) for i in p]):
    cost=0
    tmpans=0
    for i in range(d):
        if tip[i]==p[i]:
            cost+=c[i]
        tmpans+=i
        cost+=tip[i]*(i+1)*100
    if cost>=g:
        ans=min(ans,tmpans)
print(ans)

Submission status: Wrong Answer

Solution code:
(d, g) = map(int, input().split())
points = {0:0}
pc = [list(map(int, input().split())) for i in range(d)]

for i in range(d, -1, -1):
    ip = i * 100
    for k in range(len(points)):
        for j in range(1, pc[i-1][0] + 1):
            ijp = ip * j
            if j == pc[i-1][0]:
                ijp +=  pc[i-1][1]
            if k + j in points:
                points[k + j] = max(points[k + j] , points[k] + ijp)
            else:
                points[k + j] = points[k] + ijp
dct = sorted(points.items())
for i in range(1, len(dct) + 1):
    if points[i] >= g:
        print(i)
        break

Submission status: Wrong Answer

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


def dfs(G, i):
    print(G)
    if i == 0:
        return 10**12
    n = min((G-1)//(100*i)+1, PC[i][0])
    #n = min(G//(100*i), PC[i][0])
    tmp = n*100*i
    if n == PC[i][0]:
        tmp += PC[i][1]
    if tmp < G:
        n += dfs(G-tmp, i-1)
    return min(n, dfs(G, i-1))

print(dfs(G, D))

Submission status: Wrong Answer

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


for i in range(D):
    a,b=map(int,input().split())
    p.append(a)
    c.append(b)

cost=list()
for i in range(D):
    sum=0
    ans=0
    while sum<G and ans<p[i]:
        sum+=100*(i+1)
        ans+=1
    if(ans==p[i]):
        sum+=c[i]
    cost.append([sum/ans,i])

cost.sort()

ans=0
sum=0
for r in reversed(cost):
    z=p[r[1]]
    while sum<G and z>0:
        z-=1
        sum+=(r[1]+1)*100
        ans+=1
    sum+=c[r[1]]

ans1=1000000
sum1=1000000
if(G<(p[-1]-1)*D*100): 
    sum1=0
    ans1=0
    while sum1<G:
        ans1+=1
        sum1+=D*100
if(ans1<ans):
    ans1=ans1
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
import itertools

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

p_c_list = np.array([tuple(map(int, [100 * (i + 1)] + input().split())) for i in range(D)])

masks = itertools.product([False, True], repeat=len(p_c_list))

ret = np.inf
for mask in masks:
  maskedarr = p_c_list[np.array(mask), :]
  comp_sum = (maskedarr[:, 0] * maskedarr[:, 1] + maskedarr[:, 2]).sum()
  suc_num = maskedarr[:, 1].sum()
  if comp_sum < G:
    amari = (G - comp_sum) / p_c_list[~np.array(mask), 0][-1]
    if amari < p_c_list[~np.array(mask), 1][-1]:
      if ret > suc_num + amari:
        ret = suc_num + amari
    else:
      continue
  elif suc_num < ret:
    ret = suc_num
  else:
    continue
    
print(int(ret))

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import itertools

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

p_c_list = np.array([tuple(map(int, [100 * (i + 1)] + input().split())) for i in range(D)])
summary = []

masks = itertools.product([False, True], repeat=len(p_c_list))

ret = 100000000
for mask in masks:
  maskedarr = p_c_list[np.array(mask), :]
  comp_sum = (maskedarr[:, 0] * maskedarr[:, 1] + maskedarr[:, 2]).sum()
  suc_num = maskedarr[:, 1].sum()
  if comp_sum < G:
    amari = (G - comp_sum) / p_c_list[~np.array(mask), 0][-1]
    if amari < p_c_list[~np.array(mask), 1][-1]:
      if ret > suc_num + amari:
        ret = suc_num + amari
    else:
      continue
      
print(int(ret))

Submission status: Wrong Answer

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

ipsr = []
for i in range(1, d + 1):
    p, c = [int(i) for i in input().split()]
    s = i * 100 * p + c
    r = s / p
    ipsr.append([i, p, s, r])
ipsr.sort(key = lambda x: x[3], reverse=True)

ans = 0
while g > 0:
    if ipsr[0][2] < g:
        g -= ipsr[0][2]
        ans += ipsr[0][1]
        ipsr.pop(0)
        continue

    x = ipsr[0][1]
    ipsr.sort(key = lambda x: x[0], reverse=True)
    for v in ipsr:
        if v[2] > g:
            x = min(x, v[1])
        x = min(x, g // (v[0] * 100))
    ans += x
    break

print(ans)

Submission status: Wrong Answer

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

p = [None] * D
c = [None] * D

for i in range(D):
    p_i, c_i = map(int, input().split())
    p[i] = p_i
    c[i] = c_i

cnt = 100000
for i in range(1 << D):
    num = -1
    score = 0
    cnt_ = 0
    for j in range(D):
        if (i >> j) % 2 == 1:
            score += p[j] * 100 * (j+1) + c[j]
            cnt_ += p[j]
        else:
            num = j
    if score >= G:
        cnt = min(cnt, cnt_)
    else:
        if j == -1:
            pass
        else:
            n = p[j]
            while n > 0:
                n -= 1
                score += (num+ 1) * 100
                cnt_ += 1
                if score >= G:
                    cnt = min(cnt, cnt_)
                    break
print(cnt)

Submission status: Wrong Answer

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

ans = float("inf")
for bit in range(2 ** D) :
    score = 0
    AC = 0
    for k in range(D) :
        if bit & (1 << k) :
            p,c = L[k]
            score += c
            AC += p
            score += p*(k+1)*100
    if score >= G :
        ans = min(ans,AC)
        continue
    for k in range(D-1,-1,-1) :
        if bit & (1 << k) :
            continue
        p,c = L[k]
        if (score + p*(k+1)*100) < G :
            score += p*(k+1)*100
            AC += p
        else :
            rem = G - score
            AC += rem // ((k+1)*100)
            if rem % (k+1) != 0 :
                AC += 1
            ans = min(ans,AC)
            break
print(ans)

Submission status: Wrong Answer

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

point = G
cnt = 0
un_used = [lis[i][0] for i in range(D)]
while point > 0:
    kouho = []
    end_kouho = []
    # 平均point、どの問題か、個数、sum point
    for i in range(D):
        if un_used[i] == 0:
            continue
        tmp = -(-point//(100*(i+1)))
        if tmp < un_used[i]:
            if tmp*100*(i+1) >= point:
                end_kouho.append([100*(i+1),i, tmp, tmp*100*(i+1)])
            else:
                kouho.append([100*(i+1),i, tmp, tmp*100*(i+1)])
        else:
            if un_used[i]*100*(i+1) + lis[i][1] >= point:
                end_kouho.append([(un_used[i]*100*(i+1) + lis[i][1])/un_used[i],i, un_used[i], un_used[i]*100*(i+1) + lis[i][1]])
            else:
                kouho.append([(un_used[i]*100*(i+1) + lis[i][1])/un_used[i],i, un_used[i], un_used[i]*100*(i+1) + lis[i][1]])
    kouho.sort(reverse=True)
    end_kouho.sort(key=lambda x:x[2])
    if len(kouho) == 0:
        cnt += end_kouho[0][2]
        break
    if len(end_kouho) > 0:
        if end_kouho[0][2] < kouho[0][2]:
            cnt += end_kouho[0][2]
            break
    use = kouho[0]
    point -= use[3]
    un_used[use[1]] -= use[2]
    cnt += use[2]
    #print(kouho)
print(cnt)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

D,G=map( int, raw_input().split() )
P=[ map( int, raw_input().split() ) for i in range(D) ] 

N=10**6
dp= [ float("inf") for i in range(N+1)]
dp[0]=0

for idx, x  in enumerate(P):
	idx+=1
	p,c=x[0], x[1]/100
	for i in range(N,-1,-1):
		if dp[i]!=float("inf"):
			for j in range(p+1):	# j= problems count   , idx = score of a problem
				dp[i+idx*j]=min( dp[i+idx*j] , dp[i]+j )
				if j==p:
					dp[i+idx*j+c]= min( dp[i+idx*j+c], dp[ i+idx*j ] )


ans=float("inf")

for i in range(G/100,N):
	ans=min(ans, dp[i])

print ans

Submission status: Wrong Answer

Solution code:
D, G = list(map(int,input().split()))
L = []
for i in range(D):
  L.append(list(map(int, input().split())))
  L[i].append((i+1) * L[i][0] * 100 + L[i][1])
  L[i].append(L[i][2] / L[i][0])
  L[i].append((i+1)*100)
L.sort(key = lambda x:(x[3], x[2]), reverse = True)
 
num = 0
cnt = 0
for i in range(D):
  if G > L[i][2]:
    G -= L[i][2]
    cnt += L[i][0]
    num = i + 1
  else:
    break
 
mi = 100
for i in range(num, D):
  if G <= L[i][2]:
    if G < L[i][4] * L[i][0]:
      t = -(-G // L[i][4])
    else:
      t = L[i][0]
    if mi > t:
      mi = t
 
print(cnt + mi)

Submission status: Wrong Answer

Solution code:
D, G = list(map(int,input().split()))
L = []
for i in range(D):
  L.append(list(map(int, input().split())))
  L[i].append((i+1) * L[i][0] * 100 + L[i][1])
  L[i].append(L[i][2] / L[i][0])
  L[i].append((i+1)*100)
L.sort(key = lambda x:x[3], reverse = True)

num = 0
cnt = 0
for i in range(D):
  if G > L[i][2]:
    G -= L[i][2]
    cnt += L[i][0]
    num = i + 1
  else:
    break

mi = 100
for i in range(num, D):
  if G < L[i][2]:
    if G < L[i][4] * L[i][0]:
      t = -(-G // L[i][4])
    else:
      t = L[i][0]
    if mi > t:
      mi = t

print(cnt + mi)

Submission status: Wrong Answer

Solution code:
import math
d,g = map(int,input().split())
g //= 100
p = [0 for _ in range(d)]
c = [0 for _ in range(d)]
sump = [0 for _ in range(d)]
for i in range(d):
    p[i],c[i] = map(int,input().split())
    c[i] = c[i]//100
    sump[i] = (i+1)*p[i] + c[i]

min = 10000

for i in range(1<<d):
    sum = 0
    qst = 0
    maxq = 1
    for j in range(d):
        if i>>j & 1:
            sum += sump[j]
            qst += p[j]
        elif maxq < j+1:
            maxq = j+1
    if sum + maxq*p[maxq-1] < g:
        continue
    else:
        if min > max(0,math.ceil((g-sum)//maxq)) + qst:
            min = max(0,math.ceil((g-sum)//maxq)) + qst

print(min)

Submission status: Wrong Answer

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

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

V = []
for i in range(D):
    V.append(((i + 1) * 100, i, False))
    v = (P[i] * (i + 1) * 100 + C[i]) / P[i]
    V.append((v, i, True))

V = sorted(V, key=lambda x: x[0], reverse=True)

def is_valid(x):
    used = [0] * D

    score = 0
    res = x
    for v, idx, need_comp in V:
        if used[idx] == 1:
            continue

        if need_comp:
            if P[idx] <= res:
                res -= P[idx]
                score += P[idx] * (idx + 1) * 100 + C[idx]
                used[idx] = 1

        else:
            score += res * (idx + 1) * 100
            break

    return score >= G


inf = 0
sup = 1000
while sup - inf > 1:
    mid = (inf + sup) // 2

    if is_valid(mid):
        sup = mid
    else:
        inf = mid

print(sup)

Submission status: Wrong Answer

Solution code:
d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(d)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score - 1) // (100*(rest+1))
        if need > p[rest][0] - 1: # 0だったところの中で一番大きいところの問題数-1よりも必要手数が多かったら初めに戻る
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(d)]
ans = 1000

for i in range(1 << d): # 4
    score = 0
    num = 0
    rest = 0
    for j in range(d): # 2
        if ((i >> j) & 1) == 1: # 0 1  2=10
            score += p[j][0] * 100 * (j + 1) + p[j][1]
            num += p[j][0]
        else:
            rest = j
    if score < g:
        need = (g - score) // (100*(rest+1))
        if need > p[rest][0] - 1: # 0だったところの中で一番大きいところの問題数-1よりも必要手数が多かったら初めに戻る
            continue
        else:
            num += need
    ans = min(ans, num)
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
o, c = zip(*[map(int, input().split()) for _ in range(d)])

comp = [(i+1)*o[i]+c[i]//100 for i in range(d)]

G = g//100

# 大きい数（全問解く)
ans = sum(o)

for j in range(2**d):
    tmp = bin(j)
    ope = tmp[2:len(tmp)].zfill(d)

    now = 0  # 得点
    f = 1
    num = 0  # 問題数
    re = [[0, 0]]  # とかなかった問題の配列

    for i in range(d):
        if ope[i] == '1':
            now += comp[i]
            num += o[i]
        else:
            re.append([(i+1)*(o[i]-1), i+1])

        re.sort()
        re.reverse()

    if now < G:
        if now+re[0][0] < G:
            # 答えにならない
            now = sum(o)
            f = -1
        else:
            # 中途半端に解く問題数
            K = (G - now)//re[0][1]

            # 中途半端に解くときに、%==0ならちょうどgoalになるけど、それ以外の時は、ちょっとだけ点数が足りないから問題をもう一問解く
            if (G % re[0][1] > 0):
                K = K+1
            num += K
    if num < ans and f > 0:
        ans = num
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

# リスト入力
D, G = map(int, input().split())
d = []
for i in range(D):
    x, y = map(int, input().split())   
    d.append((x, y))
q = []
mem = defaultdict(lambda:defaultdict(int))
heapq.heappush(q, (0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))

while(q):
    su, v, l = heapq.heappop(q)
    for i in range(D):
        vi = -v
        li = list(l)
        if (li[i] < d[i][0]):
            li[i] += 1
            vi += (i + 1) * 100
            if (mem[vi][sum(li)] == 1):
                continue
            if (li[i] == d[i][0]):
                vi += d[i][1]
            if (vi >= G):
                print(sum(li))
                sys.exit()
            else:
                heapq.heappush(q, (sum(li), -vi, li))
                mem[vi][sum(li)] = 1