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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/2/16
Solved on 2019/2/
@author: shinjisu
"""


# ABC 104 C All Green
def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


def dmp(x):
    global debug
    if debug:
        print(x)
    return x


def probC():
    D, G = getIntList()
    dmp((D, G))
    p = getIntMat(D)
    dmp(p)
    point = [[[0, 0]]]
    # point = []
    for i in range(D):
        levelPoint = []
        for j in range(p[i][0]):
            levelPoint.append([j+1, (i+1)*(j+1)*100])
        levelPoint[-1][1] += p[i][1]
        dmp(levelPoint)
        point.append(levelPoint)
    dmp(point)
    goal = 0
    n = 0
    for i in range(-1, -len(point), -1):
        wGoal = goal
        for j in range(len(point[i])):
            if point[i][j][1]+wGoal >= G:
                dmp(('n,wGoal,i,j', n,wGoal,i,j))
                if point[i-1][-1][1]+wGoal >= G and \
                        point[i-1][-1][0] < point[i][j][0]:
                    return n + point[i-1][-1][0]
                else:
                    return n + point[i][j][0]
        n += point[i][j][0]
        goal += point[i][j][1]
        dmp(('n,goal', n, goal))
    dmp(goal)
    return -1


debug = False  # True False
print(probC())

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
PCS = [ list(map(int, input().split())) + [(i+1)*100] for i in range(D)]

def main():
    ans = float('inf')
    for i in range(1<<D): # pattern i
        g = G
        cnt = 0
        for d in range(D):
            if i & (1<<d): # Solve d
                g -= PCS[d][0]*PCS[d][2] + PCS[d][1]
                cnt += PCS[d][0]

        if g<=0:
            ans = min(ans, cnt)
            continue

        # Not done
        for d in range(D-1, -1, -1):
            if i & (1<<d):
                continue # Solved
            else: # Not yet
                n = math.ceil(g//PCS[d][2])
                if n>=PCS[d][0]:
                    break
                g -= n*PCS[d][2]
                cnt += n
                break
        if g<=0:
            ans = min(ans, cnt)

            
    return ans

print(main())

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
PCS = [ list(map(int, input().split())) + [(i+1)*100] for i in range(D)]

def main():
    ans = float('inf')
    for i in range(1<<D): # pattern i
        g = G
        cnt = 0
        for d in range(D):
            if g<=0:
                break
            if i & (1<<d): # Solve d
                g -= PCS[d][0]*PCS[d][2] + PCS[d][1]
                cnt += PCS[d][0]

        if g<=0:
            ans = min(ans, cnt)
            continue
        else: # Not done
            for d in range(D-1, -1, -1):
                if i & (1<<d):
                    continue # Solved
                else: # Not yet
                    n = math.ceil(g//PCS[d][2])
                    if n>=PCS[d][0]:
                        break
                    g -= n*PCS[d][2]
                    cnt += n
                    break
            if g<=0:
                ans = min(ans, cnt)

            
    return ans

print(main())

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
PCS = [ list(map(int, input().split())) + [(i+1)*100] for i in range(D)]

def main():
    ans = float('inf')
    for i in range(1<<D): # pattern i
        g = G
        cnt = 0
        for d in range(D):
            if g<=0:
                break
            if i & (1<<d): # Solve d
                g -= PCS[d][0]*PCS[d][2] + PCS[d][1]
                cnt += PCS[d][0]

        if g<=0:
            ans = min(ans, cnt)
            continue
        else: # Not done
            for d in range(D-1, -1, -1):
                if i & (1<<d):
                    continue # Solved
                else:
                    n = math.ceil(g//PCS[d][2])
                    if n>=PCS[d][0]:
                        continue
                    cnt += n
                    ans = min(ans, cnt)
                    break
    return ans

print(main())

Submission status: Wrong Answer

Solution code:
import math
D, G = map(int, input().split())
PCS = [ list(map(int, input().split())) + [(i+1)*100] for i in range(D)]

def main():
    ans = float('inf')
    for i in range(1<<D): # pattern i
        g = G
        cnt = 0
        for d in range(D):
            if g<=0:
                break
            if i & (1<<d): # Solve d
                g -= PCS[d][0]*PCS[d][2] + PCS[d][1]
                cnt += PCS[d][0]

        if g<=0:
            ans = min(ans, cnt)
            continue
        else: # Not done
            for d in range(D-1, -1, -1):
                if i & (1<<d):
                    continue # Solved
                else:
                    n = math.ceil(g//PCS[d][2])
                    if n>=PCS[d][0]:
                        break
                    cnt += n
                    ans = min(ans, cnt)
                    break
    return ans

print(main())

Submission status: Wrong Answer

Solution code:
import functools
import queue

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

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

def calc_score(nums):
    score = 0
    for i in range(d):
        score += 100*(i+1)*nums[i]
        if p[i] == nums[i]: score += c[i]
    return score

# 幅優先探索で探す。
# 探索予定の組み合わせを、キューで実装。
def solve():
    q = queue.Queue()
    min_num = 100000
    q.put([0]*d)
    
    while not q.empty():
        nums = q.get()
        # すでにGを超える組が見つかっているのに、それより多い組み合わせを見はじめたら終了
        if min_num < sum(nums): 
            break
        score = calc_score(nums)
        # 終了判定
        if score >= g: min_num = sum(nums)
            
        for i in range(d-1,-1,-1):
            if p[i] < nums[i]+1: continue
            next_nums = nums[:]
            next_nums[i] += 1
            q.put(next_nums)
    return min_num
solve()

Submission status: Wrong Answer

Solution code:
import functools
import queue

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

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

def calc_score(nums):
    score = 0
    for i in range(d):
        score += 100*(i+1)*nums[i]
        if p[i] == nums[i]: score += c[i]
    return score

# 幅優先探索で探す。
# 探索予定の組み合わせを、キューで実装。
def solve():
    q = queue.Queue()
    min_num = 100000
    q.put([0]*d)
    
    while not q.empty():
        nums = q.get()
        # すでにGを超える組が見つかっているのに、それより多い組み合わせを見はじめたら終了
        if min_num < sum(nums): 
            break
        score = calc_score(nums)
        # 終了判定
        if score >= g: min_num = sum(nums)
            
        for i in range(d-1,-1,-1):
            if p[i] < nums[i]+1: continue
            next_nums = nums[:]
            next_nums[i] += 1
            q.put(next_nums)
    return min_num

Submission status: Wrong Answer

Solution code:
import functools
import queue

def calc_score(nums):
    score = 0
    for i in range(d):
        score += 100*(i+1)*nums[i]
        if p[i] == nums[i]: score += c[i]
    return score

# 幅優先探索で探す。
# 探索予定の組み合わせを、キューで実装。
def solve():
    q = queue.Queue()
    min_num = 100000
    q.put([0]*d)
    
    while not q.empty():
        nums = q.get()
        # すでにGを超える組が見つかっているのに、それより多い組み合わせを見はじめたら終了
        if min_num < sum(nums): 
            break
        score = calc_score(nums)
        # 終了判定
        if score >= g: min_num = sum(nums)
            
        for i in range(d-1,-1,-1):
            if p[i] < nums[i]+1: continue
            next_nums = nums[:]
            next_nums[i] += 1
            q.put(next_nums)
    return min_num

Submission status: Wrong Answer

Solution code:
d,g = map(int, input().split())
p = []
c = []
for i in range(d):
    a,b = map(int, input().split())
    p.append(a)
    c.append(b)
    
dp = [0 for i in range(sum(p) + 2)] 
for j in range(1,d+1):
    for i in range(1,sum(p)+2):
        if i == p[j-1]:
            dp[i] = 100 * j * i + c[j-1]
        else:
            dp[i] = max(dp[i -1] + j * 100, dp[i])
            
for i,j in enumerate(dp):
    if j > g:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
I=lambda:map(int,input().split())
divup=lambda x,y:(x+y-1)//y
D,G=I()
P={};C={};Score={}
for i in range(D):P[i],C[i]=I();Score[i]=-~i*100*P[i]+C[i]
r=1e9+7
for k in range(1<<D):
    str_branch=str(bin(k))[2:].rjust(D,'0')
    sub_probs=0;sub_score=0
    for i,b in enumerate(str_branch):
        if b=='1':sub_probs+=P[i];sub_score+=Score[i]
    if sub_score>G:r=min(r,sub_probs);continue
    for i in range(D)[::-1]:
        pi=-~i*100
        if str_branch[i]=='0' and G-sub_score<pi*P[i]:
            r=min(r,sub_probs+divup(G-sub_score,pi));break
print(r)

Submission status: Wrong Answer

Solution code:
I=lambda:map(int,input().split())
divup=lambda x,y:(x+y-1)//y
D,G=I()
P={};C={};Score={}
for i in range(D):P[i],C[i]=I();Score[i]=-~i*100*P[i]+C[i]
r=2147483647
for k in range(2**D):
    str_branch=str(bin(k))[2:].rjust(D,'0')
    sub_probs=0;sub_score=0
    for i,b in enumerate(str_branch):
        if b=='1':sub_probs+=P[i];sub_score+=Score[i]
    if sub_score>G:r=min(r,sub_probs);continue
    for i in range(D)[::-1]:
        pi=-~i*100
        if str_branch[i]=='0' and G-sub_score<pi*P[i]:
            r=min(r,sub_probs+divup(G-sub_score,pi));break

r2=2147483647
for k in range(2**D):
    s=''.join((['0']*D+list(str(bin(k))[2:]))[-D:])
    vs=[(P[i]*100*(i+1)+C[i])*int(s[i]) for i in range(D)]
    v=sum(vs)
    tr=sum([P[i]*int(s[i]) for i in range(D)])
    if v>=G:
        r2=min(r,tr)
    else:
        rest_max=D-s[::-1].find('0')-1
        if rest_max<D and v+(P[rest_max]-1)*100*(rest_max+1)>=G and (G-v)//((rest_max+1)*100)<P[rest_max]:
            r=min(r,tr+(G-v)//((rest_max+1)*100))

print(min(r,r2))

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
pc=[list(map(int,input().split()))for _ in [0]*d]
r=2147483647
for k in range(2**d):
    s=''.join((['0']*d+list(str(bin(k))[2:]))[-d:])
    vs=[(pc[i][0]*100*(i+1)+pc[i][1])*int(s[i]) for i in range(d)]
    v=sum(vs)
    tr=sum([pc[i][0]*int(s[i]) for i in range(d)])
    if v>=g:
        r=min(r,tr)
    else:
        rest_max=d-s[::-1].find('0')-1
        if rest_max<d and v+(pc[rest_max][0]-1)*100*(rest_max+1)>=g and (g-v)//((rest_max+1)*100)<pc[rest_max][0]:
            r=min(r,tr+(g-v)//((rest_max+1)*100))
print(r)

Submission status: Wrong Answer

Solution code:
I=lambda:map(int,input().split())
divup=lambda x,y:(x+y-1)//y
D,G=I()
P={};C={};Score={}
for i in range(D):P[i],C[i]=I();Score[i]=-~i*100*P[i]+C[i]
r=2147483647
for k in range(2**D):
    str_branch=str(bin(k))[2:].rjust(D,'0')
    sub_probs=0;sub_score=0
    for i,b in enumerate(str_branch):
        if b=='1':sub_probs+=P[i];sub_score+=Score[i]
    if sub_score>G:r=min(r,sub_probs);continue
    for i in range(D)[::-1]:
        pi=-~i*100
        if str_branch[i]=='0' and G-sub_score<pi*P[i]:
            r=min(r,sub_probs+divup(G-sub_score,pi));break
print(r)

Submission status: Wrong Answer

Solution code:
I=lambda:map(int,input().split())
divup=lambda x,y:(x+y-1)//y
D,G=I()
P={};C={};Score={}
for i in range(D):P[i],C[i]=I();Score[i]=-~i*100*P[i]+C[i]
r=100000000
for k in range(2**D):
    str_branch=str(bin(k))[2:].rjust(D,'0')
    sub_probs=0;sub_score=0
    for i,b in enumerate(str_branch):
        if b=='1':sub_probs+=P[i];sub_score+=Score[i]
    if sub_score>G:r=min(r,sub_probs);continue
    for i in range(D)[::-1]:
        pi=-~i*100
        if str_branch[i]=='0' and G-sub_score<pi*P[i]:
            r=min(r,sub_probs+divup(G-sub_score,pi));break
print(r)

Submission status: Wrong Answer

Solution code:
I=lambda:map(int,input().split())
divup=lambda x,y:(x+y-1)//y
D,G=I()
P={};C={};Score={}
for i in range(D):P[i],C[i]=I();Score[i]=-~i*100*P[i]+C[i]
r=1000000
for k in range(2**D):
    str_branch=str(bin(k))[2:].rjust(D,'0')
    sub_probs=0;sub_score=0
    for i,b in enumerate(str_branch):
        if b=='1':sub_probs+=P[i];sub_score+=Score[i]
    if sub_score>G:r=min(r,sub_probs);continue
    for i in range(D)[::-1]:
        pi=-~i*100
        if str_branch[i]=='0' and G-sub_score<pi*P[i]:
            r=min(r,sub_probs+divup(G-sub_score,pi));break
print(r)

Submission status: Wrong Answer

Solution code:
import math

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

for k,i in enumerate(lst):
    i.append((k+1)*100)
    i.append(i[2]*i[0]+i[1])

def calcurate(pt, count, g, lst):
    lst1 = list()
    for i in lst:
        if i[3] > g - pt:
            lst1.append(i + [i[2]])
        else:
            lst1.append(i + [i[3]/i[0]])
    lst1 = sorted(lst1, key = lambda x: -x[-1])
    ps = lst1[0]
    if ps[3] > g - pt:
        count += math.ceil((g - pt) / ps[2])
        return print(count)
    elif ps[3] == g - pt:
        return print(count + ps[0])
    else:
        calcurate(pt+ps[3], count+ps[0], g, lst1[1:])

calcurate(0,0,g,lst)

Submission status: Wrong Answer

Solution code:
import math

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

for k,i in enumerate(lst):
    i.append((k+1)*100)
    i.append(i[2]*i[0]+i[1])

def calcurate(pt, count, g, lst):
    lst1 = list()
    for i in lst:
        if i[3] > g - pt:
            lst1.append(i + [i[2]])
        else:
            lst1.append(i + [i[3]/i[0]])
    lst1 = sorted(lst1, key = lambda x: -x[-1])
    ps = lst1[0]
    if ps[3] > g - pt:
        count += math.ceil((g - pt) / ps[2])
        return print(count)
    elif ps[3] == g - pt:
        return print(count + ps[0])
    else:
        print('point :', pt+ps[3], '\ncount :', count+ps[0], '\nremainlst :', lst1[1:])
        calcurate(pt+ps[3], count+ps[0], g, lst1[1:])

calcurate(0,0,g,lst)

Submission status: Wrong Answer

Solution code:
import math

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

for k,i in enumerate(lst):
    i.append((k+1)*100)
    i.append(i[2]*i[0]+i[1])

def calcurate(pt, count, g, lst):
    lst1 = list()
    for i in lst:
        if i[3] > g - pt:
            lst1.append(i + [i[2]])
        else:
            lst1.append(i + [i[3]/i[0]])
    lst1 = sorted(lst1, key = lambda x: -x[-1])
    ps = lst1[0]
    if ps[3] > g - pt:
        count += math.ceil((g - pt) // ps[2])
        return print(count)
    if ps[3] == g - pt:
        return print(count + ps[0])
    else:
        calcurate(pt+ps[3], count+ps[0], g, lst1[1:])

calcurate(0,0,g,lst)

Submission status: Wrong Answer

Solution code:
D, G = map(int,input().split())
L = []
ans = []
def ceil(i):
    if int(i) == i:
        return int(i)
    else:
        return int(i)+1


for _ in range(D):
    l = list(map(int,input().split())) +[0]
    L.append(l)
for k in range(2**D):
    value = 0
    b = format(k,'b').zfill(D)
    l = list(map(int,list(b)))
    cnt = 0
    for i in range(D):
        if l[i]:
            #print(i)
            L[i][2] = 1
            value += L[i][1]
            value += L[i][0]*(i*100)
            cnt += L[i][0]
        else:
            L[i][2] = 0
    remain = list(filter(lambda x:x[2]==0,L))[::-1]
    j = D
    if D - value > 0:
        while True:
            if remain==[]:
                cnt = 10**100
                break
            tmp = remain.pop(0)
            #print(tmp)
            if G - value <= (j*100)*(tmp[0] - 1):
                cnt += ceil((G-value)/(j*100))
                break
            else:
                cnt += tmp[0]-1
                value += (j*100)*(tmp[0]-1)
                j -= 1
    ans.append(cnt)

print(min(ans))

Submission status: Wrong Answer

Solution code:
D, G = map(int,input().split())
L = []
ans = []
def ceil(i):
    if int(i) == i:
        return int(i)
    else:
        return int(i)+1


for _ in range(D):
    l = list(map(int,input().split())) +[0]
    L.append(l)
for k in range(2**D):
    value = 0
    b = format(k,'b').zfill(D)
    l = list(map(int,list(b)))
    cnt = 0
    for i in range(D):
        if l[i]:
            print(i)
            L[i][2] = 1
            value += L[i][1]
            value += L[i][0]*(i*100)
            cnt += L[i][0]
        else:
            L[i][2] = 0
    remain = list(filter(lambda x:x[2]==0,L))[::-1]
    j = D
    if D - value > 0:
        while True:
            if remain==[]:
                cnt = 10**100
                break
            tmp = remain.pop(0)
            #print(tmp)
            if G - value <= (j*100)*(tmp[0] - 1):
                cnt += ceil((G-value)/(j*100))
                break
            else:
                cnt += tmp[0]-1
                value += (j*100)*(tmp[0]-1)
                j -= 1
    ans.append(cnt)

print(min(ans))

Submission status: Wrong Answer

Solution code:
D, G = map(int,input().split())
L = []
ans = []
def ceil(i):
    if int(i) == i:
        return int(i)
    else:
        return int(i)+1


for _ in range(D):
    l = list(map(int,input().split())) +[0]
    L.append(l)
for k in range(2**D):
    value = 0
    b = format(k,'b').zfill(D)
    l = list(map(int,list(b)))
    cnt = 0
    for i in range(D):
        if l[i]:
            print(i)
            L[i][2] = 1
            value += L[i][1]
            value += L[i][0]*(i*100)
            cnt += L[i][0]
        else:
            L[i][2] = 0
    remain = list(filter(lambda x:x[2]==0,L))[::-1]
    j = D
    if D - value > 0:
        while True:
            if remain==[]:
                cnt = 10**100
                break
            tmp = remain.pop(0)
            print(tmp)
            if G - value <= (j*100)*(tmp[0] - 1):
                cnt += ceil((G-value)/(j*100))
                break
            else:
                cnt += tmp[0]-1
                value += (j*100)*(tmp[0]-1)
                j -= 1
    ans.append(cnt)

print(min(ans))

Submission status: Wrong Answer

Solution code:
D, G=list(map(int, input().split()))
#L[i][0]:i番目の問題数、L[i][0]:i番目のボーナス得点 調整のため[0]追加
L=[0]+[list(map(int, input().split())) for i in range(D)]
#f:i番目まで考えるときの最小問題数  
def f(G, i):
    l=[]
    a=1000
    if i==0:
        return 1000
    else:
        j=min(G//(i*100), L[i][0])
        g=G-j*i*100            
        if j==L[i][0] and g-L[i][1]>0:
            a=min(a,f(g-L[i][1],i-1)+j)
        elif j==L[i][0] and g-L[i][1]<=0:
            a=min(a,L[i][0])
        elif g>0:
            a=min(f(g,i-1)+j,a)
        elif g<=0:
            a=min(a,j)
        return a
print(f(G,D))

Submission status: Wrong Answer

Solution code:
def solve(D, G, PCs):
    ans = 100
    for d in range(0, 2 ** D):
        b = "{:011b}".format(d)[::-1][:D]
        k = 0
        point = 0
        for i, c in enumerate(b):
            if c == "1":
                k += PCs[i][0]
                point += PCs[i][1] + ((i + 1) * 100 * PCs[i][0])
        if point >= G:
            ans = min(ans, k)
            continue

        for i, (p, c) in enumerate(PCs[::-1]):
            if b[D - (i + 1)] == "1":
                continue
            for _ in range(p):
                point += (D - i) * 100
                k += 1
                if point >= G:
                    break
            if point >= G:
                break
        ans = min(ans, k)
    return ans


if __name__ == "__main__":
    D, G = tuple(map(int, input().split(" ")))
    PCs = [tuple(map(int, input().split(" "))) for _ in range(D)]
    print(solve(D, G, PCs))

Submission status: Wrong Answer

Solution code:
#2-1-1 #ABC104C
d,g = map(int,input().split())
q={}
comp={}
p={}
minsolve=0
for i in range(d):
    a,b=map(int,input().split())
    q[i]=a
    p[i]=100*(i+1)
    comp[i]=100*(i+1)*a+b
    minsolve+=a
    
solve=[0 for _ in range(d)]
def roop(s,check,point,solved,minsolve):
    solve=s.copy()
    solve2=s.copy()
    if check==d:
        if 0 in solve:
            solverev=solve.copy()
            solverev.reverse()
            idx=d-solverev.index(0)-1
            shold=min(0,1+(g-point-1)//p[idx])
            if q[idx]>shold and shold>=0:
                solved+=shold
                minsolve=min(minsolve,solved)
        return minsolve

    minsolve=roop(solve,check+1,point,solved,minsolve)
    solve2[check]+=1
    minsolve=roop(solve2,check+1,point+comp[check],solved+q[check],minsolve)
    return minsolve

print(roop(solve,0,0,0,minsolve))

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
q={}
comp={}
p={}
minsolve=0
for i in range(d):
    a,b=map(int,input().split())
    q[i]=a
    p[i]=100*(i+1)
    comp[i]=100*(i+1)*a+b
    minsolve+=a
    
solve=[0 for _ in range(d)]
def roop(s,check,point,solved,minsolve):
    solve=s.copy()
    solve2=s.copy()
    if check==d:
        if 0 in solve:
            solverev=solve.copy()
            solverev.reverse()
            idx=d-solverev.index(0)-1
            shold=1+(g-point-1)//p[idx]
            if q[idx]>shold and shold>=0:
                solved+=shold
            else:return minsolve
            if solved<minsolve:return solved
        return minsolve

    minsolve=roop(solve,check+1,point,solved,minsolve)
    solve2[check]+=1
    minsolve=roop(solve2,check+1,point+comp[check],solved+q[check],minsolve)
    return minsolve

print(roop(solve,0,0,0,minsolve))

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
q={}
comp={}
p={}
minsolve=0
for i in range(d):
    a,b=map(int,input().split())
    q[i]=a
    p[i]=100*(i+1)
    comp[i]=100*(i+1)*a+b
    minsolve+=a
    
solve=[0 for _ in range(d)]
def roop(s,check,point,solved,minsolve):
    solve=s.copy()
    solve2=s.copy()
    if check==d:
        if 0 in solve:
            solverev=solve.copy()
            solverev.reverse()
            idx=d-solverev.index(0)-1
            shold=1+(g-point-100)//p[idx]
            if q[idx]>shold and shold>=0:
                solved+=shold
            else:return minsolve
            if solved<minsolve:return solved
        return minsolve

    minsolve=roop(solve,check+1,point,solved,minsolve)
    solve2[check]+=1
    minsolve=roop(solve2,check+1,point+comp[check],solved+q[check],minsolve)
    return minsolve

print(roop(solve,0,0,0,minsolve))

Submission status: Wrong Answer

Solution code:
import numpy as np
d, g = map(int ,input().split())
points = [list(map(int,input().split())) for _ in range(d)]

def min_q(comp_flg, target_score): # comp_flag[i]=True以外の問題iについて、compポイントを無視してtarget_scoreを超えるには最低いくつの問題数が必要かを返す
    score = 0
    q_num = 0
    for i in range(d-1,-1,-1):
        if comp_flg[i]:
            continue
        if target_score>score+points[i][0]*(i+1)*100:
            score += points[i][0]*(i+1)*100+points[i][1]
            q_num += points[i][0] 
        else:
            q_num += np.ceil((target_score-score)//(100*(i+1)))
            break
    return q_num


mn = float('inf')
for i in range(1<<d):
    complete_flg = [False]*d
    tmp_q_num = 0
    tmp_point = 0
    for j in range(d):
        if i&(2**j) != 0:
            tmp_point += points[j][0] * 100*(j+1) + points[j][1]
            complete_flg[j] = True
            tmp_q_num += points[j][0]
    # print('tmp_point, tmp_q_num',tmp_point, tmp_q_num)
    if tmp_point < g:
        tmp_q_num += min_q(complete_flg, g-tmp_point)
    if mn>tmp_q_num:
        mn = tmp_q_num

print(int(mn))

Submission status: Wrong Answer

Solution code:
#2-1-1 #ABC104C
d,g=map(int,input().split())
q=[]
comp=[]
for i in range(d):
    p,c=map(int,input().split())
    q.append(p)
    comp.append(100*(i+1)*p+c)
    
p=[100*i for i in range(1,d+1)]
solve=[0 for i in range(d)]
def roop(comp,p,solve,check,point,solved,minsolve):
    if check==d:
        if 0 in solve:
            solvecop=solve.copy()
            solvecop.reverse()
            idx=solvecop.index(0)
            idx=d-1-idx
            shold=1+(g-point-100)//p[idx]
            if q[idx]>shold and shold>=0:
                solved+=shold
            else:return minsolve
        if minsolve>solved:return solved
        return minsolve
    solve2=solve.copy()
    minsolve=roop(comp,p,solve,check+1,point,solved,minsolve)
    solve2[check]+=1
    minsolve=roop(comp,p,solve2,check+1,point+comp[check],solved+q[check],minsolve)
    return minsolve

print(roop(comp,p,solve,0,0,0,sum(q)))

Submission status: Wrong Answer

Solution code:
import math

D,G = map(int, input().split())
l=[list(map(int,input().split())) for i in range(D)]
lst=[[(i+1)*100]*(l[i][0]-1) + [(i+1)*100 + l[i][1]] for i in range(len(l))]
ans = 100*D
dis = 100000*D
for i in range(1<<D):
    print(bin(i))
    point,num,maxp=0,0,0
    for j in range(D):
        if (i>>j)&1:
            num+=len(lst[j])
            point+=sum(lst[j])
        else:
            maxp=j
    if point + (maxp+1)*100*(len(lst[maxp])-1) >= G:
        mq = max(0,math.ceil((G-point)/((maxp+1)*100)))
        ans = min(ans, num+mq)
print(int(ans))

Submission status: Wrong Answer

Solution code:
import math

D,G = map(int, input().split())
l=[list(map(int,input().split())) for i in range(D)]
lst=[[(i+1)*100]*(l[i][0]-1) + [(i+1)*100 + l[i][1]] for i in range(len(l))]
ans = 100*D
dis = 100000*D
for i in range(1<<D):
    point,num,maxp=0,0,0
    for j in range(D):
        if (i>>j)&1:
            num+=len(lst[j])
            point+=sum(lst[j])
        else:
            maxp=j
    if point + (maxp+1)*100*(len(lst[maxp])-1) >= G:
        mq = max(0,math.ceil(G-point)/((maxp+1)*100))
        ans = min(ans, num+mq)
print(int(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])
    if score >= G:
        ans = min(ans, count)
    else:
        j_max = max([i for i in list(range(D)) if i not in complete_list])
        required = -(-(G - score) // (100 * (j_max + 1)))
        if required < P[j_max]:
            score += required * 100 * (j_max + 1)
            count += required
            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 G > score and j >= 0:
        if j not in complete_list:
            required = -(-(G - score) // (100 * (j + 1)))
            if required < P[j]:
                score += required * 100 * (j + 1)
                count += required
            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)))
            if required < P[j]:
                score += required * 100 * (j + 1)
                count += required
            break
        j -= 1
    if score >= G:
        ans = min(ans, count)
print(ans)