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=[[int(i) for i in input().split()] for j in range(d)]

i=d
c=0
while g>0:
  if g > p[i-1][0]*i*100 + p[i-1][1]:
    g -= p[i-1][0]*i*100 + p[i-1][1]
    c += p[i-1][0]
  else:
    t = (g+100*i-1)//(100*i)
    if p[i-2][0] <= t:
      if p[i-2][0]*(i-1)*100+p[i-2][1] >= g: 
        g -= p[i-2][0]*(i-1)*100+p[i-2][1]
        c += p[i-2][0]
        t = (g+100*i-1)//(100*i)
    g -= i*100*t
    c += t
  i -= 1

print(c)

Submission status: Wrong Answer

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

p = []
c = []
for i in range(D):
    tmp = [int(i) for i in input().split()]
    p.append(int(tmp[0]))
    c.append(int(tmp[1]))

def AccuracyQestionNum(acc_list, count):
    counter = count
    for i in range(len(acc_list)):
        if acc_list[i] == 1:
            counter += p[i]
    return counter

def MaxScoreIndex(acc_list):
    for i in reversed(range(len(acc_list))):
        if acc_list[i] == 0:
            return i
        
def FinalQestionNum(acc_list, score):
    remain_point = G - score
    counter = 0
    max_score_index = MaxScoreIndex(acc_list)
    for i in range(p[max_score_index]):
        remain_point -= (max_score_index+1) * 100
        counter += 1
        if remain_point <= 0:
            break

    if counter == p[max_score_index]:
        return None
    else:
        return counter
        
def ScoreCalculation(acc_list):
    score = 0
    for i in range(len(acc_list)):
        if acc_list[i] == 1:
            score += (i+1) * 100 * p[i]
            score += c[i]
    return score

def DFSQestion(acc_list):
    """先に全探索で得たスコアを計算して, 正解数もカウントしておく"""
    if len(acc_list) == D:
        score = ScoreCalculation(acc_list)
        if score >= G:
            question_num = AccuracyQestionNum(acc_list, 0)
            print(acc_list, 0)
        else:
            count = FinalQestionNum(acc_list, score)
            if count == None:
                return None
            else:
                question_num = AccuracyQestionNum(acc_list, count)
        return question_num
    else:
        question_num1 = DFSQestion(acc_list + [0])
        question_num2 = DFSQestion(acc_list + [1])
        if question_num1 == None:
            return question_num2
        if question_num2 == None:
            return question_num1
        if question_num1 >= question_num2:
            return question_num2
        else:
            return question_num1
        
question_num = DFSQestion([])

print(question_num)



"""
全ての問題に対する全探索(おバカな探索)
sum_question  = 0
for i in range(D):
    sum_question += p[i]

def ScoreCalculation(question_list):
    pre_i = 0
    count = 0
    score = 0
    for p_i in range(len(p)):
        count = sum(question_list[pre_i : pre_i + p[p_i]])
        pre_i += p[p_i]
        score += (p_i+1) * 100 * count
        if count == p[p_i]:
            score += c[p_i]
        
    return score

def DFSAccuracy(question_list):
    if len(question_list) == sum_question:
        score = ScoreCalculation(question_list)
        if score >= G:
            return question_list
        else:
            return None
    else:
        result1 = DFSAccuracy(question_list + [1])
        result2 = DFSAccuracy(question_list + [0])

        if result1 == None:
            return result2
        elif result2 == None:
            return result1
        else:
            que_num1 = sum(result1)
            que_num2 = sum(result2)
            if  que_num1< que_num2:
                return result1
            else:
                return result2

ans_list = DFSAccuracy([])
accuracy_num = sum(ans_list)
print(accuracy_num)
"""

Submission status: Wrong Answer

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

ans=sum(p)
for k in range(1<<D):
    s=[i for i in range(1,D+1) if k>>(i-1)&1]

    num=sum([p[i] for i in s])
    rest=G-sum([100*i*p[i]+c[i] for i in s])

    for j in range(D,0,-1):
        if rest<=0:
            break
        if j not in s:
            q=(rest+(j-1)*100)//(j*100) 
            if q>=p[j]:
                num+=p[j]-1
                rest-=(j*100)*(p[j]-1)
            else:
                num+=q
                rest-=(j*100)*q

    ans=min(ans,num)

print(ans)

Submission status: Wrong Answer

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

ans=sum(p)
for k in range(1<<D):
    s=[i for i in range(1,D+1) if k>>(i-1)&1]

    num=sum([p[i] for i in s])
    rest=G-sum([100*i*p[i]+c[i] for i in s])

    while rest>0:
        for j in range(D,0,-1):
            if j not in s:
                q=(rest+(j-1)*100)//(j*100) 
                if q>=p[j]:
                    num+=p[j]-1
                    rest-=(j*100)*(p[j]-1)
                else:
                    num+=q
                    rest-=(j*100)*q
    ans=min(ans,num)

print(ans)

Submission status: Wrong Answer

Solution code:
#ABC104C - All Green
import math
def dfs(i,s,c,r):
    global ans
    if i == d:
        if s < g:
            use = max(r)
            n = min(pc[use -1][0], math.ceil((g-s)/(use*100)))
            c += n
            s += n*use*100
        if s >= g:
            ans = min(ans,c)
            print(c)
    
    else:
        dfs(i+1, s, c, r)
        dfs(i+1, s+ pc[i][0]*(i+1)*100+pc[i][1],c+pc[i][0],r-{i+1})
        
d,g = list(map(int,input().split()))
pc = [list(map(int,input().split())) for i in range(d)]

ans = float("inf")

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

Submission status: Wrong Answer

Solution code:
import math
D,G=[int(s) for s in input().split()]
ls=[[int(s) for s in input().split()] for i in range(D)]
maxD=2**D-1
def need(num):
  val=num
  score=0
  prob=0
  for i in range(D):
    if val%2==1:
      score+=ls[i][0]*(i+1)*100+ls[i][1]
      prob+=ls[i][0]
    val//=2
  if score>=G:
    return prob
  else:
 #   print(score)
    k=int(math.log2(num^maxD))
    x=(score-G)//((k+1)*100)
    if -x<=ls[k][0]:
      return -x+prob
    else:
      return 10000
print(min([need(i+1) for i in range(maxD)]))

Submission status: Wrong Answer

Solution code:
import math
D,G=[int(s) for s in input().split()]
ls=[[int(s) for s in input().split()] for i in range(D)]
maxD=2**D-1
def need(num):
  val=num
  score=0
  prob=0
  for i in range(D):
    if val%2==1:
      score+=ls[i][0]*(i+1)*100+ls[i][1]
      prob+=ls[i][0]
    val//=2
  if score>=G:
    return prob
  else:
 #   print(score)
    k=int(math.log2(num^maxD))
    x=(score-G)//((k+1)*100)
    if -x<=ls[k][0]:
      return -x+prob
    else:
      return 10000

print(min([need(i) for i in range(maxD)]))

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
pc = []
m = 0
for i in range(d):
  pc.append(list(map(int,input().split())))
  m += pc[-1][0]
for i in range(2**d-1):
  cur = bin(i)[2:]
  cur = '0'*(d-len(cur)) + cur
  csum = 0
  cc = 0
  for j in range(d):
    if cur[j] == '0':
      ci = j
    else:
      csum += (j+1)*100*pc[j][0] + pc[j][1]
      cc += pc[j][0]
  if csum >= g:
    m = min(m,cc)
  elif csum + (ci+1) * 100 * pc[ci][0] >= g:
      m = min(m,cc+(g-csum)//(100*(ci+1)))
print(m)

Submission status: Wrong Answer

Solution code:
import numpy as np
d, g = map(int, input().split())
p = []
c = []
for _ in range(d):
    _p, _c = map(int, input().split())
    p.append(_p)
    c.append(_c)

s = np.arange(1, d + 1) * 100
p = np.array(p)

ans_list = []

bool_list = [False] * d

state_list = []

def dfs(i, n, bool_list):
    bool_list = bool_list.copy()
    if i == n:
        state_list.append(bool_list)
    else:
        dfs(i + 1, n, bool_list)
        bool_list[i] = True
        dfs(i + 1, n, bool_list)

dfs(0, d, bool_list)

for state in state_list:
    if np.dot(s * p, state) + np.dot(c, state) >= g:
        ans_list.append(np.dot(p, state))
    else:
        score = max(s * np.array([not i for i in state]))
        for j in range(1, p[score%100]):
            if np.dot(s * p, state) + np.dot(c, state) + score * j >= g:
                ans_list.append(np.dot(p, state) + j)

print(min(ans_list))

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p = []
c = []
for _ in range(d):
    _p, _c = map(int, input().split())
    p.append(_p)
    c.append(_c)

res = 0
count = 0
ans_list = []

def dfs(i, p, c, res, count):
    if i == 0:
        if res >= g:
            ans_list.append(count)
    else:
        for j in reversed(range(p[i - 1] + 1)):
            _count = count + j
            _res = res + 100 * j * i
            if j == p[i - 1]:
                _res += c[i - 1]
            if _res <= g:
                dfs(i - 1, p, c, _res, _count)
                break
            else:
                dfs(i - 1, p, c, _res, _count)

dfs(d, p, c, res, count)
print(min(ans_list))

Submission status: Wrong Answer

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

ans=1000
for i in range(1 << D):
    p=P
    cnt=0
    num=0
    
    for j in range(D):
       
        if (i >> j)&1:
            cnt+=100*(j+1)*p[j][0]+p[j][1]
            num+=p[j][0]
            
    if cnt<G:
        for k in range(D,0,-1):
            
            if ((i >> k-1)&1)==0:
                while cnt<G:
                    cnt+=k*100
                    num+=1
                break
            
            
        
    ans=min(ans,num)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import*
from math import*
d,g=map(int,input().split())
g//=100
xxx=[tuple([i])+tuple(map(int,input().split()))for i in range(1,d+1)]   #問題数 ボーナス
#print(xxx)
yyy=[(score,score*num+bonus//100,num)for score,num,bonus in xxx]
ans=[]
l=[]
for i in range(d+1):
    for j in combinations(yyy,i):
        tmp1=0
        tmp2=0
        tmpl=set()
        for x,y,z in j:
            tmp1+=y
            tmp2+=z
            tmpl.add(x)
        if tmp1>=g:
            ans.append(tmp2)
        else:
            l.append((tmpl,g-tmp1,tmp2))  
#print(ans)
#print(l)
for s,t,r in l:  #使ったもの 必要なスコア そこまでの枚数
    for x,y,_ in xxx[::-1]:  #スコア 枚数
        if x not in s:
            if x*y<t:
                break
            else:
                ans.append(r+floor(t/x))

for x,y,_ in xxx[::-1]:
    if x*y>=g:
        ans.append(floor(g/x))
print(min(ans))

Submission status: Wrong Answer

Solution code:
from itertools import*
from math import*
d,g=map(int,input().split())
g//=100
xxx=[tuple([i])+tuple(map(int,input().split()))for i in range(1,d+1)]   #問題数 ボーナス
#print(xxx)
yyy=[(score,score*num+bonus//100,num)for score,num,bonus in xxx]
ans=[]
l=[]
for i in range(d+1):
    for j in combinations(yyy,i):
        tmp1=0
        tmp2=0
        tmpl=set()
        for x,y,z in j:
            tmp1+=y
            tmp2+=z
            tmpl.add(x)
        if tmp1>=g:
            ans.append(tmp2)
        else:
            l.append((tmpl,g-tmp1,tmp2))  
#print(ans)
#print(l)
for s,t,r in l:  #使ったもの 必要なスコア そこまでの枚数
    for x,y,_ in xxx[::-1]:  #スコア 枚数
        if x not in s:
            if x*y<=t:
                break
            else:
                ans.append(r+floor(t/x))
print(min(ans))

Submission status: Wrong Answer

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

ans = float('inf')
for i in range(1<<D):
    point = 0
    count = 0
    for j in range(D, 0, -1):
        if i>>j-1&1:
            point += j * 100 * P[j] + C[j]
            count += P[j]
    for k in range(D, 0, -1):
        if not i>>k-1&1 and P[k] > 1:
            for _ in range(P[k]-1):
                if point < G:
                    point += k * 100
                    count += 1
                else:
                    break
            if point >= G:
                ans = min(ans, count)
            break
print(ans)

Submission status: Wrong Answer

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

ans = float('inf')
for i in range(1<<D):
    point = 0
    count = 0
    for j in range(D, 0, -1):
        if i>>j-1&1:
            point += j * 100 * P[j] + C[j]
            count += P[j]
    for k in range(D, 0, -1):
        if (i^(1<<D)-1)>>k-1&1 and P[k] > 1:
            for _ in range(P[k]-1):
                if point < G:
                    point += k * 100
                    count += 1
                else:
                    break
            if point >= G:
                ans = min(ans, count)
            break
print(ans)

Submission status: Wrong Answer

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

import math

d,g = map(int,input().split())
pl = []
cl = []

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

ans = float('inf')
for i in range(2 ** d):
    op = [0] * d
    for j in range(d):
        if ((i >> j) & 1):
            op[j] = 1  # フラグが立っていた箇所を "+" で上書き

    tmp_ans = 0
    tmp_point = 0
    
    for idx, (o,p,c) in enumerate(zip(op, pl, cl)):
        tmp_ans += o*p
        tmp_point += o*c + (idx+1) * 100 * p*o
        
    rest_point = g - tmp_point
    if rest_point <= 0:
        if ans > tmp_ans:
            ans = tmp_ans
        continue
    
    last_solve = d-op[::-1].index(0)-1
    need = math.ceil(rest_point // ((last_solve+1) * 100))
    if need <= pl[last_solve]:
        tmp_ans += need
        if ans > tmp_ans:
            ans = tmp_ans
    
print(ans)

Submission status: Wrong Answer

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

import math

d,g = map(int,input().split())
pl = []
cl = []

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

ans = float('inf')
for i in range(2 ** d):
    op = [0] * d
    for j in range(d):
        if ((i >> j) & 1):
            op[j] = 1  # フラグが立っていた箇所を "+" で上書き

    tmp_ans = 0
    tmp_point = 0
    
    for idx, (o,p,c) in enumerate(zip(op, pl, cl)):
        tmp_ans += o*p
        tmp_point += o*c + (idx+1) * 100 * p*o
        
    rest_point = g - tmp_point
    if rest_point <= 0:
        if ans > tmp_ans:
            ans = tmp_ans
        continue
    
    last_solve = d-op[::-1].index(0)-1
    need = math.ceil(rest_point // ((last_solve+1) * 100))
    if need < pl[last_solve]:
        tmp_ans += need
        if ans > tmp_ans:
            ans = tmp_ans
    
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

d,g = inpl()
p = [0] * d
c = [0] * d
for i in range(d):
    p[i], c[i] = inpl()
res = float('inf')


for flag in itertools.product((0,1),repeat=d):
    sco = 0
    cnt = 0
    for i,j in enumerate(flag):
        if j:
            sco += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    # print(flag,sco,cnt)
    if sco >= g:
        res = min(res, cnt)
    else:
        rem = g - sco #残り
        for i,j in enumerate(flag):
            if not j:
                tmp = rem//((i+1)*100)
                # print(flag,tmp)
                if tmp < p[i]:
                    res = min(res, cnt+tmp)
print(res)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
ps = [tuple(map(int, input().split())) for _ in range(d)]
ans = 0
for i in reversed(range(d)):
  j = i+1
  pnt = ps[i][0]*100*j+ps[i][1]
  if g >= pnt:
    g -= pnt
    ans += ps[i][0]
  else:
    ans += g//(100*j)
    break
print(ans)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(d)]
dp=[[-1]*(1000) for i in range(d)]
for i in range(d):
    dp[i][0]=0
lst=[]
for i in range(d):
    p,c=pc[i]
    h=[0]
    for j in range(1,p):
        h.append(100*(i+1)*j)
    h.append(100*(i+1)*p+c)
    lst.append(h)
for i in range(d):
    p,c=pc[i]
    h=lst[i]
    if i==0:
        for j in range(1,p+1):
            dp[0][j]=h[j]
    else:
        for j in range(1,p+1):
            for k in range(j,1000):
                if dp[i-1][k-j]!=-1:
                    dp[i][k]=max(dp[i-1][k-j]+h[j],dp[i-1][k])
                else:
                    break
for i in range(1,1000):
    if dp[d-1][i]>=g:
        print(i)
        break

Submission status: Wrong Answer

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

ans = float("inf")

for bit in range(1 << d):
    count = 0
    sum = 0
    L = set(range(1, d + 1))
    
    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            L.discard(i + 1)
                
    if sum < g:
        use=max(L)
        n = min(pc[use-1][0], (g - sum) // (use * 100))
        count += n
        sum += n * use * 100

    if sum >= g:
        ans = min(ans, count)
        
print(ans)

Submission status: Wrong Answer

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

ans = float("inf")

for bit in range(1 << d):
    count = 0
    sum = 0
    L=[]
    nokori = set(range(1, d + 1))
    
    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
            nokori.discard(i + 1)
        else:
            L.append(i+1)
        
    if sum < g:
        use=max(L)
        n = min(pc[use-1][0], (g - sum) // (use * 100))
        count += n
        sum += n * use * 100

    if sum >= g:
        ans = min(ans, count)
        
print(ans)

Submission status: Wrong Answer

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

ans = float("inf")

for bit in range(1 << d):
    count = 0
    sum = 0
    L=[]

    for i in range(d):
        if bit & (1 << i):
            sum += pc[i][0] * (i + 1) * 100 + pc[i][1]
            count += pc[i][0]
        else:
            L.append(i+1)
            
    if sum < g:
        n = min(pc[max(L)-1][0], (g - sum) // (max(L) * 100))
        count += n
        sum += n * max(L) * 100

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

print(ans)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
A=[list(map(int,input().split())) for i in range(D)]
ans=10**3

for bit in range(1<<D):
  point=0
  count=0
  L=[]
  for i in range(D):
    if bit&(1<<i):
      point+=A[i][1]+A[i][0]*(i+1)*100
      count+=A[i][0]
    else:
      L.append(i+1)
      
  if point >= G:
    ans=min(ans,count)
    
  else:
    x=min((G-point)/(max(L)*100),A[max(L)-1][0])
    count+=x
    point+=x*max(L)*100
  
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

d, g = map(int, input().split())
data = getSomeInputListInt(d)
basecost = 100

ans = 0

for i in range(d):
    data[i].insert(0, i+1)
    data[i].append(0)

flg = True

while(flg):

    for i in range(len(data)):
        if basecost * data[i][0] * data[i][1] + data[i][2] <= g:
            data[i][3] = basecost * data[i][0] + data[i][2]/data[i][1]
        else:
            data[i][3] = basecost * data[i][0]

    data = sorted(data, key=lambda x:x[3], reverse=True)

    flg2 = True
    while(flg2):
        g -= data[0][0]*basecost
        data[0][1] -= 1
        ans += 1

        if data[0][1] == 0:
            g -= data[0][2]
            flg2 = False
            del data[0]

        if g <= 0 :
            flg2 = False
            flg = False

print(ans)

Submission status: Wrong Answer

Solution code:
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

d, g = map(int, input().split())
data = getSomeInputListInt(d)
basecost = 100

ans = 0

for i in range(d):
    data[i].insert(0, i+1)
    data[i].append(0)

flg = True

while(flg):

    for i in range(len(data)):
        if basecost * data[i][0] * data[i][1] <= g:
            data[i][3] = basecost * data[i][0] + data[i][2]/data[i][1]
        else:
            data[i][3] = basecost * data[i][0]

    data = sorted(data, key=lambda x:x[3], reverse=True)

    flg2 = True
    while(flg2):
        g -= data[0][0]*basecost
        data[0][1] -= 1
        ans += 1

        if data[0][1] == 0:
            g -= data[0][2]
            flg2 = False
            del data[0]

        if g <= 0 :
            flg2 = False
            flg = False

print(ans)

Submission status: Wrong Answer

Solution code:
N,G=map(int,input().split())
l1=[]
l2=[]
for i in range(N):
  l1.append(list(map(int,input().split())))
  l2.append([(l1[-1][0]*100*(i+1)+l1[-1][1])/l1[-1][0], l1[-1][0], l1[-1][0]*100*(i+1)+l1[-1][1], l1[-1][1], 100*(i+1)])
l2.sort()
def check(l2,G,ans):
  channel=False
  while G>l2[-1][2]:
    G-=l2[-1][2]
    ans+=l2[-1][1]
    l2.pop()
    channel=True
  if channel:
    l2[-1][0]=l2[-1][4]
    l2.sort()
    return check(l2,G,ans)
  else:
    l2[-1][0]=l2[-1][4]
    l2.sort()
    if l2[-1][-1]*l2[-1][1]<G:
      ans+=l2[-1][1]
    elif G%l2[-1][4]==0:
      ans+=(G//l2[-1][4])
    else:
      ans+=1+G//l2[-1][4]
    return ans

print(check(l2,G,0))

Submission status: Wrong Answer

Solution code:
N,G=map(int,input().split())
l1=[]
l2=[]
for i in range(N):
  l1.append(list(map(int,input().split())))
  l2.append([(l1[-1][0]*100*(i+1)+l1[-1][1])/l1[-1][0], l1[-1][0], l1[-1][0]*100*(i+1)+l1[-1][1], l1[-1][1], 100*(i+1)])
l2.sort()

def check(l2,G,ans):
  channel=False
  while G>l2[-1][2]:
    G-=l2[-1][2]
    ans+=l2[-1][1]
    l2.pop()
    channel=True
  if channel:
    l2[-1][0]=l2[-1][4]
    l2.sort()
    return check(l2,G,ans)
  else:
    if G%l2[-1][4]==0:
      ans+=(G//l2[-1][4])
    else:
      ans+=1+G//l2[-1][4]
    return ans

print(check(l2,G,0))

Submission status: Wrong Answer

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

question_list = []

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


ans = 10 ** 5

for i in range(D): # i番目を中途半端に解く
    others = D - 1

    for j in range(2 ** others): # jのビットが立っているところを全部解く
        bit = format(j, "0" + str(D) + "b")
        total = 0
        num_q = 0
        for k in range(D):
            if k == i:
                continue
            if bit[k] == "1":
                total += question_list[k][0] * 100 * (k + 1) + question_list[k][1]
                num_q += question_list[k][0]
        
        res = max(0, G - total)
        if res > 0: # 中途半端に解く問題で数を合わせる
            res_q = res // (100 * (i + 1))# + (1 if res % (100 * (i+1)) != 0 else 0)
            if res_q > question_list[i][0]: # 中途半端に解く問題数でカバーしきれないなら
                continue
            num_q += res_q
        
        ans = min(ans, num_q)

print(ans)

Submission status: Wrong Answer

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

question_list = []

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


ans = 10 ** 5

for i in range(D): # i番目を中途半端に解く
    others = D - 1

    for j in range(2 ** others): # jのビットが立っているところを全部解く
        bit = format(j, "0" + str(D) + "b")
        total = 0
        num_q = 0
        for k in range(D):
            if k == i:
                continue
            if bit[k] == "1":
                total += question_list[k][0] * 100 * (k + 1) + question_list[k][1]
                num_q += question_list[k][0]
        
        res = max(0, G - total)
        if res > 0: # 中途半端に解く問題で数を合わせる
            res_q = res // (100 * (i + 1)) + (1 if res % (100 * (i+1)) != 0 else 0)
            if res_q > question_list[i][0]: # 中途半端に解く問題数でカバーしきれないなら
                continue
            num_q += res_q
        
        ans = min(ans, num_q)

print(ans)

Submission status: Wrong Answer

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

question_list = []

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


ans = 10 ** 5

for i in range(D): # i番目を中途半端に解く
    others = D - 1

    for j in range(2 ** others): # jのビットが立っているところを全部解く
        bit = format(j, "0" + str(D) + "b")
        total = 0
        num_q = 0
        for k in range(D):
            if k == i:
                continue
            if bit[k] == "1":
                total += question_list[k][0] * 100 * (k + 1) + question_list[k][1]
                num_q += question_list[k][0]
        
        res = max(0, G - total)
        res_q = 0
        if res > 0: # 中途半端に解く問題で数を合わせる
            res_q = res // (100 * (i + 1)) + (1 if res % (100 * (i + 1)) > 0 else 0)
            if res_q > question_list[i][0]: # 中途半端に解く問題数でカバーしきれないなら
                continue
            num_q += res_q
        
        ans = min(ans, num_q)

Submission status: Wrong Answer

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

question_list = []

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


ans = 10 ** 5

for i in range(D): # i番目を中途半端に解く
    others = D - 1

    for j in range(2 ** others): # jのビットが立っているところを全部解く
        bit = format(j, "0" + str(D) + "b")
        total = 0
        num_q = 0
        for k in range(D):
            if k == i:
                continue
            if bit[k] == "1":
                total += question_list[k][0] * 100 * (k + 1) + question_list[k][1]
                num_q += question_list[k][0]
        
        res = max(0, G - total)
        if res > 0: # 中途半端に解く問題で数を合わせる
            res_q = int(res / (100 * (i + 1)) + 0.5)
            if res_q > question_list[i][0]: # 中途半端に解く問題数でカバーしきれないなら
                continue
            num_q += res_q
        
        ans = min(ans, num_q)

print(ans)

Submission status: Wrong Answer

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

question_list = []

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


ans = 10 ** 5

for i in range(D): # i番目を中途半端に解く
    others = D - 1

    for j in range(2 ** others): # jのビットが立っているところを全部解く
        bit = format(j, "0" + str(D) + "b")
        total = 0
        num_q = 0
        for k in range(D):
            if k == i:
                continue
            if bit[k] == "1":
                total += question_list[k][0] * 100 * (k + 1) + question_list[k][1]
                num_q += question_list[k][0]
        
        res = max(0, G - total)
        if res > 0: # 中途半端に解く問題で数を合わせる
            res_q = res // (100 * (i + 1))
            if res_q > question_list[i][0]: # 中途半端に解く問題数でカバーしきれないなら
                continue
            num_q += res_q
        
        ans = min(ans, num_q)

print(ans)