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

dp = defaultdict(int)
dp[0] = 0
for i, (p, c) in enumerate(pc):
    dp_cur = list(dp.items())
    for p_cur, n_cur in dp_cur:
        if p_cur > g:
            break
        for n in range(1, p+1):
            if n < p:
                if dp[p_cur+n*100*(i+1)] == 0:
                    dp[p_cur+n*100*(i+1)] = n_cur+n
                else:
                    dp[p_cur+n*100*(i+1)] = min(dp[p_cur+n*100*(i+1)], n_cur+n)
                if p_cur+n*100*(i+1) > g:
                    break
            else:
                if dp[p_cur+n*100*(i+1)+c] == 0:
                    dp[p_cur+n*100*(i+1)+c] = n_cur+n
                else:
                    dp[p_cur+n*100*(i+1)+c] = min(dp[p_cur+n*100*(i+1)+c], n_cur+n)

# print(dp)
ans = 10**9
v = 0
for p, n in list(dp.items()):
    if p < g:
        continue
    else:
        ans = min(ans, n)
print(ans)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
data=[]
for i in range(1,D+1):
    li = list(map(int,input().split()))
    li.insert(0,i*100)
    li.append(li[0]*li[1]+li[2])
    data.append(li)
    
maxpoint=0
while True:
    if data[-1][0]*data[-1][1] >= G:
        maxsolve = G//data[-1][0]+1
        nomax=[]
        for li in data:
            if li[3]>G:nomax.append(li[1])
        maxpoint+=min(nomax)
        break
    elif data[-1][3] >= G:
        maxpoint+=data[-1][1]
        break
    else:
        maxpoint+=data[-1][1]
        G-=data[-1][3]
        del data[-1]

print(maxpoint)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
pc=[list(map(int,input().split()))for _ in [0]*d]
s=0
r=0
for i in reversed(range(d)):
    t=(g-s)//((i+1)*100)
    if t<=pc[i][0]:print(r+t);exit()
    else:s+=(i+1)*100*pc[i][0]+pc[i][1];r+=pc[i][0]

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
D, G = map(int, input().split())
p = []
c = []
n = []
for i in range(D):
  p_, c_ = map(int, input().split())
  n.append(100 *(i+1))
  p.append(p_)
  c.append(c_)

def my_func(G, n, p, c):
  p_min = np.nan
  p_ = np.nan
  i_ = np.nan
  G_ = np.nan
  for i in range(len(n)):
    p_ = int(G / n[i])
    if p_ < p[i]:
      if np.isnan(p_min):
        p_min = p_
      elif p_ < p_min:
        p_min = p_
    else:
      if G <= n[i] * p[i] + c[i]:
        if np.isnan(p_min):
          p_min = p[i]
        elif p[i] < p_min:
          p_min = p[i]
    if np.isnan(p_):
      G_ = n[i] * p[i] + c[i]
      i_ = i
      p_ = p[i]
    elif p[i] < p_:
      G_ = n[i] * p[i] + c[i]
      i_ = i
      p_ = p[i]
  return p_min, i_, G_

p_ = 0
p_min_ = np.nan
G_hoge = G
n_hoge = list(n)
p_hoge = list(p)
c_hoge = list(c)
while True:
  p_min, i_, G_ = my_func(G_hoge, n_hoge, p_hoge, c_hoge)
  if not np.isnan(p_min):
    p_min_ = p_ + p_min
    break
  G_hoge = G_hoge - G_
  p_ = p_ + p_hoge[i_]
  del n_hoge[i_]
  del p_hoge[i_]
  del c_hoge[i_]

print(p_min_)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
list=[]
for i in range(d):
    p,c=map(int,input().split())
    x=((i+1)*p*100+c)
    list.append([p,c,x,(i+1)*100])
list.sort(key=lambda x:x[3])
list.reverse()
a=0
while g>0:
    t=0
    b=900
    for i in list:
        if i[3]*i[0]>=g:
            b=min(b,(g+i[3]-1)//i[3])
            if b==(g+i[3]-1)//i[3]:
                c=i
    list.sort(key=lambda x:x[1])
    for i in list:
        if i[2]>=g:
            if b>i[0]:
                a+=i[0]
                list.remove(i)
            else:
                a+=b
                list.sort(key=lambda x:x[3])
                list.remove(c)
            g=0
            t=1
            break
    if t==0:
        list.sort(key=lambda x:x[3])
        list.reverse()
        g-=list[0][2]
        a+=list[0][0]
        list.remove(list[0])
        list.sort(key=lambda x:x[3])
        list.reverse()
print(a)

Submission status: Wrong Answer

Solution code:
import math

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

ans = []
for i in range(d):
    ans.append(100*(i+1)*p[i] + c[i])

pre = int(1e9)
tmp = 0
for j in range(d):
    for i in range(d):
        if(ans[i] >= g):
            if(p[i] < pre): pre = p[i]
            if(100*(i+1)*(p[i]-1) >= g):
                if(math.ceil(g / (100*(i+1))) < pre): pre = math.ceil(g / (100*(i+1)))
    if(pre == int(1e9)):
        pans = []
        for i in range(d):
            pans.append(ans[i] / p[i])
        g -= ans[pans.index(max(pans))]
        tmp += p[pans.index(max(pans))]
        ans[pans.index(max(pans))] = 0

print(pre + tmp)

Submission status: Wrong Answer

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

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

    
costlist = []
for i in range(len(p)):
    costlist.append([(i+1)*100,p[i], p[i]*(i+1)*100 + c[i]])
costlist.sort(key = lambda x: x[2],reverse = True)

myscore = 0
myproblem = 0
for onelist in costlist:
    if myscore < g and myscore + onelist[2] <g :
        myscore += onelist[2]
        myproblem += onelist[1]
        onelist = [-1,-1,-1]
    elif myscore < g and myscore + onelist[2] >= g:
        break
    else:
        continue
while [-1,-1,-1] in costlist:
    costlist.remove([-1,-1,-1])
costlist.sort(key = lambda x: x[0],reverse = True)

while myscore < g:
    myscore += costlist[0][0]
    myproblem += 1
    
print(myproblem)

Submission status: Wrong Answer

Solution code:
import sys
d, g = map(int, input().split())
P = {}
C = {}
for i in range(1,d+1):
    p, c = map(int, input().split())
    P[i] = p
    C[i] = c

# Mに含まれる点数の問題をk問解いた時の最高点
# 例: M = [1, 2, 5]
def maxscore(k, M):
    #print(k, M)
    # コンプ込みの平均点
    A = {}
    for i in M:
        if P[i] <= k:
            A[i] = 100*i + C[i]/P[i]
        else:
            A[i] = 100*i
    # 平均点の一番高いやつを採用
    i, a = sorted(A.items(), key=lambda x: -x[1])[0]
    #print(i, a)

    if P[i] <= k:
         score = 100*i*P[i] + C[i]
    else:
         return 100*i*k

    M.remove(i)
    k -= P[i]
    if len(M) > 0 and k > 0:
        score += maxscore(k, M)

    return score

k = 1
while(True):
    score = maxscore(k, list(range(1,d+1)))
    if score >= g:
        print(k)
        sys.exit(0)
    k += 1

Submission status: Wrong Answer

Solution code:

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

num=[]
bns=[]

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

#print(num,bns)
#print(D,G)
#print(D*100*num[D-1])

n=0
for i in range(D):
    if D*100*num[D-1] < G:
        G += -D*100*num[D-1]-bns[D-1]
        n += num[D-1]
        D += -1
    else:
        break

#print(D,G,n)
#print(num,bns)

N=num[D-1]

for i in range(D):
    k=1
    sum = (D-i)*100*k
    while sum < G and k < num[D-i-1]:
        k+=1
        sum = (D-i)*100*k
    if k==num[D-i-1]:
        sum+=bns[D-i-1]
    if sum >= G:
        N = min(N,k)
#    print(sum,k)


print(N+n)

Submission status: Wrong Answer

Solution code:
def fa(): #final answer
    global ans
    print(ans)
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

def alltansaku(points, rem, cur, num, need):
    a,b = points[cur-1]
    if a*cur*100 + b >= need:
        if a*cur*100 >= need:
            p = need//(cur*100)
            if need%cur != 0:
                p += 1
            #print(p,num,"p")
            return num + p
        else:
            return num + a
    else:
        num += a
        need -= (a*cur*100+b)
        remm = [i for i in rem]
        #print(remm,cur)
        remm.remove(cur)
        #print(rem,"c")
        p = 10000000000
        for i in remm:
            temp = alltansaku(points, remm, i, num, need)
            if temp < p:
                p = temp
        return p


D,G = getNM()
rem = [i+1 for i in range(D)]
points = []

for i in range(D):
    p,c = getNM()
    points.append((p,c))
#print(points)
ans = 100000000000
for i in rem:
    temp = alltansaku(points, rem, i, 0, G)
    #print(i,temp,ans)
    if temp < ans:
        ans = temp



print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

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

P = set()
p = {}
c = {}
s = {}
for i in range(1, D + 1):
    pi, ci = map(int, input().split())
    score = 100 * i * pi + ci
    P.add(i)
    s[i] = score
    p[i] = pi
    c[i] = ci


def complete(pset):
    score = 0
    solved = 0
    comped = set()
    i = 1
    for b in pset:
        if b:
            score += s[i]
            solved += p[i]
            comped.add(i)
        i += 1
    return score, solved, comped


def left(norm, comped):
    if norm <= 0:
        return 0
    i = max(P - comped)
    res = norm // (100 * i)
    if res * 100 * i < res:
        res += 1
    if res <= p[i]:
        return res
    else:
        raise Exception


ans = float("inf")
for pset in itertools.product((True, False), repeat=D):
    try:
        score, solved, comped = complete(pset)
        solved += left(G - score, comped)
        ans = min(ans, solved)
    except:
        pass

print(ans)

Submission status: Wrong Answer

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

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


def dp(g, used_index, mincount):
    for index in range(D):
        if index in used_index:
            continue
        point = (index+1) * 100

        if point * p[index] > g:
            #`kosuu
            count = int(math.floor(g / point))
            if mincount > count:
                mincount = count


        elif mincount <= p[index]:
            continue

        elif point * p[index] + c[index] > g:
            count = p[index]
            if mincount > count:
                mincount = count
        else:
            new_g = g - (point * p[index] + c[index])
            new_used_index = copy.deepcopy(used_index)
            new_used_index.append(index)
            count = dp(new_g, new_used_index, mincount) + p[index]
            if mincount > count:
                mincount = count

    return mincount

ret = dp(G,[], 100*10)
print(ret)

Submission status: Wrong Answer

Solution code:
import math

D, G = map(int, input().split())
d_s, g_s = [], []
for _ in range(D):
    d,g = map(int, input().split())
    d_s.append(d)
    g_s.append(g)

def solve(cur_G, cur_num):
    global d_s
    global g_s
    possible = []
    for ix, (d, g) in enumerate(zip(d_s, g_s)):
        m = d*(ix+1)*100
        if m + g >= cur_G:
            possible.append([m, d])
        num = cur_G/(100*(ix+1))
        if math.ceil(num) <= d:
            possible.append([cur_G, num])
    if len(possible)>0:
        min_num = min([x[1] for x in possible])
        return min_num + cur_num
    else:
        d = d_s[-1]
        g = g_s[-1]
        cur_G -= d * (ix+1) * 100 + g
        d_s = d_s[:-1]
        g_s = g_s[:-1]
        return solve(cur_G, cur_num + d)
print(int(solve(G, 0)))

Submission status: Wrong Answer

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

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

    
costlist = []
for i in range(len(p)):
    costlist.append([(i+1)*100,p[i], p[i]*(i+1)*100 + c[i]])
costlist.sort(key = lambda x: x[2],reverse = True)

myscore = 0
myproblem = 0
for onelist in costlist:
    if myscore < g and myscore + onelist[2] <=g :
        myscore += onelist[2]
        myproblem += onelist[1]
        onelist = [-1,-1,-1]
    else:
        continue
while [-1,-1,-1] in costlist:
    costlist.remove([-1,-1,-1])
costlist.sort(key = lambda x: x[0],reverse = True)

while myscore < g:
    myscore += costlist[0][0]
    myproblem += 1
    
print(myproblem)

Submission status: Wrong Answer

Solution code:
import math


def f():
    d, g = map(int, input().split(' '))
    ps = []
    cs = []
    for i in range(d):
        p, c = map(int, input().split(' '))
        ps.append(p)
        cs.append(c)

    count = 0
    curr = 0

    while(True):
        potentials = []
        for i in range(d):
            potential = (i + 1) * 100 * ps[i] + cs[i]
            if g <= potential and ps[i] > 0:
                potentials.append(-ps[i])
            else:
                potentials.append(-1)
        max_p = -10000000000
        max_p_index = -1
        for i in range(d):
            potential = potentials[i]
            if potential == -1:
                continue
            if max_p < potential:
                max_p = potential
                max_p_index = i
        if max_p_index == -1:
            for rev in range(d):
                i = d - rev - 1
                if ps[i] > 0:
                    ps[i] -= 1
                    count += 1
                    curr += (i + 1) * 100
                    if ps[i] == 0:
                        curr += cs[i]
                    break
        else:
            n = ps[max_p_index]
            curr_best = n
            for i in range(d):
                v = 100 * (i + 1)
                num_req = math.ceil(g / v)
                if num_req < curr_best:
                    curr_best = num_req
            if curr_best != n:
                print(curr_best)
                return

            count += ps[max_p_index]
            curr += ps[max_p_index] * (max_p_index + 1) * 100 + cs[max_p_index]
            ps[max_p_index] = 0
        if curr >= g:
            print(count)
            return


f()

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
pcs = [[int(s) for s in input().split()] for _ in range(D)]
 
def calc(pcs, D, G):
    if G <= 0:
        return 0
    if D == 0:
        return 10000000
 
    t = G // (D * 100)
    
    if t < pcs[D - 1][0]:
        if D == 1:
            return t
        else:
            return min(t, calc(pcs, D - 1, G))
    else:
        nG = G - (pcs[D - 1][0] * D * 100) - pcs[D - 1][1]
        t = pcs[D - 1][0] + calc(pcs, D - 1, nG)
        for n in reversed(range(pcs[D - 1][0])):
            t2 = n + calc(pcs, D - 1, G - n * D * 100)
            if t <= t2:
                break
            else:
                t = t2
        return t
 
print(calc(pcs, D, G))

Submission status: Wrong Answer

Solution code:
import sys

in_str=input().split()
p=[]
c=[]

D=int(in_str[0])
G=int(in_str[1])

result=0

for i in range(D):
    in_str=input().split()
    p_in=int(in_str[0])
    g_in=int(in_str[1])

    p.append(p_in)
    c.append(g_in)
    
for j in range(len(p)-1,-1,-1):
    for k in range(p[j]):
        if(G>0):
            G-=100*(j+1)
            result+=1
        else:
            print(result)
            sys.exit()
    G-=c[j]

Submission status: Wrong Answer

Solution code:
D, G = [int(s) for s in input().split()]
pcs = [[int(s) for s in input().split()] for _ in range(D)]
 
def calc(pcs, D, G):
    if G <= 0:
        return 0
    if D == 0:
        return 10000000
 
    t = G // (D * 100)
    
    if t < pcs[D - 1][0]:
        if D == 1:
            return t
        else:
            return min(t, calc(pcs, D - 1, G))
    else:
        nG = G - (pcs[D - 1][0] * D * 100) - pcs[D - 1][1]
        t = pcs[D - 1][0] + calc(pcs, D - 1, nG)
        for n in reversed(range(pcs[D - 1][0])):
            t2 = n + calc(pcs, D - 1, G - n * D * 100)
            if t < t2:
                break
            else:
                t = t2
        return t
 
print(calc(pcs, D, G))

Submission status: Wrong Answer

Solution code:
D, G = map(int, raw_input().split())
p = []
c = []
for i in range(D):
	_p, _c = map(int, raw_input().split())
	p.append(_p)
	c.append(_c)

dp = [[0] * (sum(p) + 1) for i in range(D + 1)]
for i in range(D):
	for j in range(sum(p)):
		dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
		for k in range(p[i] + 1):
			flag = 1 if k == p[i] else 0	
			if j >= k:
				dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - k] + k * (i+1) * 100 + flag * c[i])

for i in range(sum(p)):
	if G <= dp[D][i]:
		print(i)
		break

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p = [[0,0] for i in range(d)]
for i in range(d):
    p[i][0], p[i][1] = map(int, input().split())
ans = 0
sum = 0
i = d
j = 0
extra_ans = [0 for i in range(d)]
while sum < g:
    j += 1
    ans += 1
    sum += i * 100
    if j == p[i-1][0]:
        sum += p[i-1][1]
        i -= 1
        j = 0
for i in range(d):
    if p[i][0] * (i+1) * 100 + p[i][1] >= g and p[i][0] < ans:
        ans = p[i][0]
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import combinations
D, G = map(int, input().split())
pc = [[i] + list(map(int, input().split())) for i in range(1,D+1)]
pc2 = [i[1] for i in pc]
res = float("inf")
for n in range(0,D+1):
    for _ in combinations(pc,n):
        memo = pc2[::]
        tmp = 0
        count = 0
        for i,p,c in _:
            tmp += p*100*i + c
            count += p
            memo[i-1] = 0
        if tmp>=G:
            res = min(res,count)
        else:
            for k in range(D-1,-1,-1):
                if (G - (tmp + (k+1)*100*memo[k])) < 0:
                    count += (G-tmp)// ((k+1)*100) 
                    count += 1 if (G-tmp)%(k+1)*100*memo[k]!=0 else 0
                    res = min(res,count)
                else:
                    tmp += (k+1)*100*memo[k]
                    count += memo[k]

print(res)

Submission status: Wrong Answer

Solution code:
import itertools
import math

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

P = set()
p = {}
c = {}
s = {}
for i in range(1, D + 1):
    pi, ci = map(int, input().split())
    score = 100 * i * pi + ci
    P.add(i)
    s[i] = score
    p[i] = pi
    c[i] = ci


def complete(pset):
    score = 0
    solved = 0
    comped = set()
    i = 1
    for b in pset:
        if b:
            score += s[i]
            solved += p[i]
            comped.add(i)
        i += 1
    return score, solved, comped


def left(norm, comped):
    if norm <= 0:
        return 0
    i = max(P - comped)
    res = int(math.floor(norm / (100 * i)))
    if res <= p[i]:
        return res
    else:
        raise Exception


ans = float("inf")
for pset in itertools.product((True, False), repeat=D):
    try:
        score, solved, comped = complete(pset)
        solved += left(G - score, comped)
        ans = min(ans, solved)
    except:
        pass

print(ans)

Submission status: Wrong Answer

Solution code:
d, g = [int(i) for i in input().split()]
p_list = []
c_list = []
for i in range(d):
    p, c = [int(j) for j in input().split()]
    p_list.append(p)
    c_list.append(c)


def greedy():
    score = 0
    num = 0
    for i in range(d)[::-1]:
        s = 100 * (i+1)
        c = c_list[i]
        p = p_list[i]
        if score + s*p_list[i] + c < g:
            score += s*p_list[i] + c
            num += p
            continue
        elif score + s*p_list[i] + c == g:
            num += p
            return num
        elif g - score < s*p:
            if (g-score) % s == 0:
                num += (g-score) // s
            else:
                num += (g-score) // s +1
            return num
        else:
            score += s * p_list[i] + c
            num += p
            return num

def bornus():
    c_dct = {}
    for i in range(d):
        c_dct[str(i)] = c_list[i] / p_list[i]

    score = 0
    num = 0
    for k, v in sorted(c_dct.items(), key=lambda x: -x[1]):
        i = int(k)
        s = 100 * (i + 1)
        p = p_list[i]
        c = c_list[i]
        if score + s*p + c < g:
            score += s*p + c
            num += p
            continue
        elif score + s*p + c == g:
            num += p
            return num
        elif g - score < s*p:
            if (g-score) % s == 0:
                num += (g-score) // s
            else:
                num += (g-score) // s +1
            return num
        else:
            score += s * p + c
            num += p
            return num



ans_a = greedy()
ans_b = bornus()
print(min(ans_a, ans_b))

Submission status: Wrong Answer

Solution code:
import copy

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


score=[None]*D
for i in range(D):
    score[i]=list(map(int,input().split()))

comp=[None]*D

for i in range(D):
    comp[i]=score[i][0]*(i+1)*100+score[i][1]


number=0
for i in range(D):
    number+=score[i][0]

dplist=[None]*(number+1)
for i in range(number+1):
    dplist[i]=[(0,[0 for i in range(D)])]


def scoresolve(X):
    ANS=0
    for i in range(len(X)):
            ANS+=X[i]*(i+1)*100
            if X[i]==score[i][0]:
                ANS+=score[i][1]

    return ANS

dplist[number]=(sum(comp),[score[i][0] for i in range(D)])
dplist[0]=(0,[0 for i in range(D)])

def DP(x):
    ANS=0
    for i in range(D):
        xx=copy.deepcopy(dplist[x+1][1])
        if xx[i]==0:
            continue
        else:
            xx[i]-=1
        if scoresolve(xx)>ANS:
            retlist=copy.deepcopy(xx)
            retnum=scoresolve(xx)
            ANS=retnum

    return (retnum,retlist)

for i in range(number-1,0,-1):
    #print(dplist)
    dplist[i]=DP(i)

for i in range(number+1):
    if dplist[i][0]>=G:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
pc = [tuple(map(int, input().split())) for i in range(D)]
p, c = zip(*pc)

ans = 0

import numpy as np
import math

haiten_list = list(range(D))

comp_list = []
for i in range(len(p)):
    comp = (i+1) * 100 * p[i] + c[i]
    comp_list.append(comp)
p_arr = np.array(p)
# c_arr = np.array(c)
comp_arr = np.array(comp_list)

cspa = comp_arr / p_arr

cspa_argsorted = np.argsort(cspa)[::-1]

for i in cspa_argsorted:
    if G > comp_arr[i]:
        G -= comp_arr[i]
        haiten_list.remove(i)
        ans += p[i]
    else:
        j = max(haiten_list)
        if G / (j+1) / 100 > p[i]:
            G -= comp_arr[i]
            haiten_list.remove(i)
            ans += p[i]
        else:
            k = math.floor(G / (j+1) / 100)
            G -= k * 100 * (j+1)
            ans += k
    if G <= 0:
        break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
d,g=input().split()
d,g=[int(d),int(g)]
a=[]
for i in range(0,d):
    a.append([int(i) for i in input().split()])
s=0
i=d-1
while i>=0:
    s=(a[i][0]*(i+1)*100)+a[i][1]
    if s<=g:
        break
    i-=1
if i==-1:
    i=0
j=i
ans=0
count=0
m=sys.maxsize
for i in range(0,d):
    if g%((100)*(i+1))==0:
        l=g//((100)*(i+1))
        if l<=a[i][0]:
            m=i+1
            break
while j>=0:
    c=0
    for i in range(1,a[j][0]+1):
        ans+=(100)*(j+1)
        count+=1
        c+=1
        #print(ans,count)
        if ans>=g:
            break
        #c+=1
        #count+=1
    if ans>=g:
        break
    if c==a[j][0]:
        ans+=a[j][1]
    if ans>=g:
        break
    j-=1
print(min(count,m))

Submission status: Wrong Answer

Solution code:
import math

D,G = map(int,input().split())
mapping = [list(map(int,input().split())) for i in range(D)]
ans = 0

for i in reversed(range(D)):
    score = (i+1)*100
    full_score = score * mapping[i][0] + mapping[i][1]

    if G < score * mapping[i][0]:
        ans = ans + math.ceil(G/score)
        break

    elif G <= full_score:
        ans = ans + mapping[i][0]
        break

    G = G - full_score
    ans = ans + mapping[i][0]
    # print('scoreは{}'.format(score))
    # print('残りのGは{}'.format(G))

print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product
D,G = map(int,input().split())
p,c = [0]*D,[0]*D
for i in range(D):
  p[i],c[i] = list(map(int,input().split()))
m = 10*100*10
for a in product([True,False], repeat=D):
  g,n = G,0
  for i in range(D):
    if a[i]:
      n += p[i]
      g -= (c[i]+(i+1)*100*p[i])
  if g <= 0 and n < m:
    m = n
    continue
  elif m < n:
    continue
  else: #g > 0 and n < m
    for i in reversed(range(D)):
      if a[i]:
        continue
      if g >= (i+1)*100*p[i]:
        continue
      n += (g+(i+1)*100-1) // ((i+1)*100)
      if n < m:
        m = n
      break
print(m)

Submission status: Wrong Answer

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

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


def dp(g, used_index):
    mincount = 100 *  10
    for index in range(D):
        if index in used_index:
            continue
        point = (index+1) * 100

        if point * p[index] > g:
            #`kosuu
            count = int(math.floor(g / point))
            if mincount > count:
                mincount = count
        elif point * p[index] + c[index] > g:
            count = p[index]
            if mincount > count:
                mincount = count
        else:
            new_g = g - (point * p[index] + c[index])
            new_used_index = copy.deepcopy(used_index)
            new_used_index.append(index)
            count = dp(new_g, new_used_index) + p[index]
            if mincount > count:
                mincount = count

    return mincount

ret = dp(G,[])
print(ret)

Submission status: Wrong Answer

Solution code:
from itertools import product
D,G = map(int,input().split())
p,c = [0]*D,[0]*D
for i in range(D):
  p[i],c[i] = list(map(int,input().split()))
m = 10*100*10
for a in product([True,False], repeat=D):
  g,n = G,0
  for i in range(D):
    if a[i]:
      n += p[i]
      g -= (c[i]+(i+1)*100*p[i])
  if g < 0 and n < m:
    m = n
    continue
  elif m < n:
    continue
  else: #g > 0 and n < m
    for i in reversed(range(D)):
      if a[i]:
        continue
      if g >= (i+1)*100*p[i]:
        continue
      n += (g+(i+1)*100-1) // ((i+1)*100)
      if n < m:
        m = n
      break
print(m)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p = [0 for i in range(d)]
c = [0 for i in range(d)]
ans = 0
min_p = 101
min_p_i = 10
for i in range(d):
    p[i], c[i] = map(int, input().split())
    if min_p >= p[i]:
        min_p = p[i]
        min_p_i = i
score = [0 for i in range(d)]
max_score = -1
max_score_i = -1
used_i = []
for i in range(d):
    if min_p_i == i:
        score[i] = 100*(i+1)*min_p+c[i]
    else:
        score[i] = 100*(i+1)*min_p
    if max_score < score[i]:
        max_score = score[i]
        min_score_i = i
min_n = -(-g // (100*d))
if min_n < min_p and min_n <= p[d-1]:
    ans += min_n
elif max_score >= g:
    ans += min_p
else:
    loopFlag = True
    tmp = 0
    for i in range(d-1, -1, -1):
        for j in range(p[i]):
            ans += 1
            tmp += 100*(i+1)
            if tmp >= g:
                loopFlag = False
                break
        if loopFlag:
            tmp += c[i]
        elif loopFlag == False or tmp >= g:
            break
print(ans)

Submission status: Wrong Answer

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

p_list = []
c_list = []
for i in range(D):
    p, c = map(int, input().split())
    p_list.append(p)
    c_list.append(c)

fi = 0
co = 0
result1=0
for i in range(D-1, -1, -1):
    if fi >= G:
        break
    p = p_list[i]
    while p > 0:
        p -= 1
        fi += 100 * (i+1)
        result1 +=1
        if p==0:
            fi += c_list[i]
        if fi >= G:
            break
print(result1)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!


N,D=map(int,input().split())
S=[[0 for i in range(11)] for k in range(11) ]
for i in range(N):
    S[i]=list(map(int,input().split()))

count=0

counts=[]
for i in range(N):
    counts.append(S[i][0])

while D>0:
    D-=len(counts)*100
    counts[len(counts)-1]-=1
    if counts[len(counts)-1]==0:
        D-=S[len(counts)-1][1]
        del counts[-1]
    count+=1
print(count)

Submission status: Wrong Answer

Solution code:
D, G = map(int, raw_input().split())
p = []
c = []
for i in range(D):
	_p, _c = map(int, raw_input().split())
	p.append(_p)
	c.append(_c)

dp = [[0] * (sum(p) + 1) for i in range(D + 1)]
for i in range(D):
	for j in range(sum(p)):
		for k in range(p[i] + 1):
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])

			flag = 1 if k == p[i] else 0	
			if j >= k:
				dp[i + 1][j] = max(dp[i + 1][j], dp[i + 1][j - k] + k * (i+1) * 100 + flag * c[i])

for i in range(sum(p)):
	if G <= dp[D][i]:
		print(i)
		break

Submission status: Wrong Answer

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

p_list = []
c_list = []
for i in range(D):
    p, c = map(int, input().split())
    p_list.append(p)
    c_list.append(c)

fi = 0
co = 0
result1=0
for i in range(D-1, -1, -1):
    if fi >= G:
        break
    p = p_list[i]
    while p > 0:
        p -= 1
        fi += 100 * (i+1)
        result1 +=1
        if p==0:
            fi += c_list[i]
        if fi >= G:
            break