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())
s_list = [[0 for _ in range(2)] for __ in range(d)]
for i in range(d):
    s_list[i][0], s_list[i][1] = map(int, input().split())
ans = 100000
for i in range(1 << d):
    ansi = 0
    m_res = 0
    total_score = 0
    for j in range(d):
        if(i & (1 << j)):
            ansi += s_list[j][0]
            total_score += s_list[j][0]*(j+1)*100 + s_list[j][1]
        else:
            m_res = j
    if(total_score < g):
        di = g - total_score
        num = int(di / (100*(m_res+1)))
        if(num > s_list[m_res][0]):
            continue
        ansi += num
    ans = min(ansi, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
s_list = [[0 for _ in range(2)] for __ in range(d)]
for i in range(d):
    s_list[i][0], s_list[i][1] = map(int, input().split())
ans = 100000
for i in range(1 << d):
    ansi = 0
    m_res = 0
    total_score = 0
    for j in range(d):
        if(i & (1 << j)):
            ansi += s_list[j][0]
            total_score += s_list[j][0]*(j+1)*100 + s_list[j][1]
        else:
            m_res = j
    if(total_score < g):
        di = g - total_score
        num = di // (100*(m_res+1))
        if(num > s_list[m_res][0]):
            continue
        ansi += num
    ans = min(ansi, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n, s=map(int,input().split())
q=[list(map(int, input().split())) for i in range(n)]

import numpy as np
import copy

dt=[0]*n
cp=[0]*n
ck=[0]*n

for i in range(n):
	dt[i]=100*(i+1)+q[i][1]//q[i][0]
	cp[i]=100*(i+1)*q[i][0]+q[i][1]

score=sum(cp)
cnt=np.sum(q, axis=0)[0]

for i in range(n):
	id=np.argmin(dt)
	score-=cp[id]
	cnt-=q[id][0]
	dt[id]=999999999
	ck[id]=i+1
	if score<=s:
		break

#print(cp)
#print(score)
#print(cnt)
#print(dt)
#print(ck)

cnt1=999
for i in range(n):
	if dt[i]==999999999:
		if cp[i]+score>=s:
			cnt1=min(cnt1,q[i][0])

res1=cnt+cnt1
#print(res1)

for i in range(n):
	if ck[n-1-i]>0:
  		id2=n-1-i
  		break

#print(id2)

res2=999999999
for i in range(q[id2][0]):
	score+=(id2+1)*100
	if score>=s:
		res2=cnt+i+1
		break

#print(res2)
#print(score)

print(min(res1,res2))

Submission status: Wrong Answer

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

    p = [0] * d
    c = [0] * d

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

    ans = 1010

    for i in range(d ** 2):

        sum = 0
        cnt = 0

        for j in range(d):

            if (i >> j) & 1:
                sum += (j + 1) * 100 * p[j]
                sum += c[j]

                cnt += p[j]

        if sum < g:

            for k in range(d)[::-1]:

                if not (i >> k) & 1:

                    if g-sum < (k+1) * 100 * p[k]:

                        cnt += (g-sum) // ((k+1) * 100)
                        sum += g-sum

                        if g-sum % ((k+1) * 100) != 0 & g-sum != 0:
                            cnt += 1

                    break

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

    print(ans)
    
resolve()

Submission status: Wrong Answer

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

    p = [0] * d
    c = [0] * d

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

    ans = 1010

    for i in range(d ** 2):

        sum = 0
        cnt = 0

        for j in range(d):

            if (i >> j) & 1:
                sum += (j + 1) * 100 * p[j]
                sum += c[j]

                cnt += p[j]

        if sum < g:

            for k in range(d)[::-1]:

                flag = 0

                if not (i >> k) & 1:

                    if g-sum < (k+1) * 100 * p[k]:

                        cnt += (g-sum) // ((k+1) * 100)
                        sum += g-sum
                        
                    break

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

    print(ans)
    
resolve()

Submission status: Wrong Answer

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

    p = [0] * d
    c = [0] * d

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

    ans = 1010

    for i in range(d ** 2):

        sum = 0
        cnt = 0

        for j in range(d):

            if (i >> j) & 1:
                sum += (j + 1) * 100 * p[j]
                sum += c[j]

                cnt += p[j]

        if sum < g:

            for k in range(d)[::-1]:

                flag = 0

                if not (i >> k) & 1:

                    for _ in range(p[k] - 1):

                        if sum >= g:
                            flag = 1
                            break

                        sum += (k + 1) * 100
                        cnt += 1

                    flag = 1

                if flag:
                    break

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

    print(ans)


resolve()

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
g = g // 100
tmp = 0
cands = []
for i in range(1, d + 1):
  p, c = map(int, input().split())
  cand = [i for _ in range(p)]
  cand[-1] += c // 100
  tmp += sum(cand)
  cands.append(cand)
  
while True:
  if tmp <= g:
    print(sum([len(cand) for cand in cands]))
    break
  lasts = [cand[-1] if len(cand) else float('inf') for cand in cands]
  index = lasts.index(min(lasts))
  tmp -= lasts[index]
  cands[index] = cands[index][:-1]

Submission status: Wrong Answer

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

minimum = 0

for i in range(2**d):
    score = 0
    solved = 0
    for j in range(d):
        if (i >> j) & 1 == 1:
            score += scoreMap[j][0] * 100 * (j + 1) + scoreMap[j][1]
            solved += scoreMap[j][0]
    if score < g:
        for k in range(d)[::-1]:
            if (i >> k) & 1 == 0:
                if (g - score > scoreMap[k][0] * 100 * (k + 1)):
                    score += scoreMap[k][0] * 100 * (k + 1) + scoreMap[k][1]
                    solved += scoreMap[k][0]
                else:
                    solved += (g - score) // (100 * (k + 1))
                    if (g - score) % (100 * (k + 1)) != 0:
                        solved += 1
                    score = g
                    break
    if minimum == 0 or solved < minimum:
        minimum = solved

print(minimum)

Submission status: Wrong Answer

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

minimum = 0

for i in range(2**d-1):
    score = 0
    solved = 0
    for j in range(d):
        if (i >> j) & 1 == 1:
            score += scoreMap[j][0] * 100 * (j + 1) + scoreMap[j][1]
            solved += scoreMap[j][0]
    if score < g:
        for k in range(d)[::-1]:
            if (i >> k) & 1 == 0:
                if (g - score > scoreMap[k][0] * 100 * (k + 1)):
                    score += scoreMap[k][0] * 100 * (k + 1) + scoreMap[k][1]
                    solved += scoreMap[k][0]
                else:
                    solved += (g - score) // (100 * (k + 1))
                    if (g - score) % (100 * (k + 1)) != 0:
                        solved += 1
                    score = g
                    break
    if minimum == 0 or solved < minimum:
        minimum = solved

print(minimum)

Submission status: Wrong Answer

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

minimum = 0

for i in range(2**d-1):
    score = 0
    solved = 0
    for j in range(d):
        if (i >> j) & 1 == 1:
            score += scoreMap[j][0] * 100 * (j + 1) + scoreMap[j][1]
            solved += scoreMap[j][0]
    if score < g:
        for j in range(d)[::-1]:
            if (i >> j) & 1 == 0:
                if (g - score > scoreMap[j][0] * 100 * (j + 1)):
                    score += scoreMap[j][0] * 100 * (j + 1) + scoreMap[j][1]
                    solved += scoreMap[j][0]
                else:
                    solved += (g - score) // (100 * (j + 1))
                    if (g - score) % (100 * (j + 1)) != 0:
                        solved += 1
                    break
    if minimum == 0 or solved < minimum:
        minimum = solved

print(minimum)

Submission status: Wrong Answer

Solution code:
def resolve():

    d, g = map(int, input().split())

    p = [0] * d
    c = [0] * d

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

    ans = 1010

    for i in range(d ** 2):

        sum = 0
        cnt = 0

        for j in range(d):

            if (i >> j) & 1:

                sum += (j + 1) * 100 * p[j]
                sum += c[j]

                cnt += p[j]

        if sum < g:

            for k in range(d)[::-1]:

                flag = 0

                if not (i >> k) & 1:

                    for _ in range(p[k] - 1):

                        if sum >= g:
                            flag = 1
                            break

                        sum += (k+1) * 100
                        cnt += 1

                if flag:
                    break

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

    print(ans)
    
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():

    d, g = map(int, input().split())

    p = [0] * d
    c = [0] * d

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

    ans = 1010

    for i in range(d ** 2):

        sum = 0
        cnt = 0

        for j in range(d):

            if (i >> j) & 1:

                sum += (j + 1) * 100 * p[j]
                sum += c[j]

                cnt += p[j]

        if sum < g:

            for k in range(d)[::-1]:

                flag = 0

                if not (i >> k) & 1:

                    for _ in range(p[k]):

                        if sum >= g:
                            flag = 1
                            break

                        sum += (k+1) * 100
                        cnt += 1

                if flag:
                    break

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

    print(ans)
    
resolve()

Submission status: Wrong Answer

Solution code:
import sys


if __name__ == '__main__':
    D, G = map(int, input().split())
    pc =[list(map(int, input().split())) for _ in range(D)]

    answer = sys.maxsize
    for bit in range(2 ** D):
        tmp_answer = 0
        score = 0
        state = []
        for i in range(D):
            if ((bit >> i) & 1):
                score += pc[i][1] + pc[i][1] * 100 * (i + 1)
                tmp_answer += pc[i][0]
        if score >= G:
            answer = min(answer,tmp_answer)
        else:
            for i in reversed(range(D)):
                if ((bit >> i) & 1):
                    continue
                else:
                    for j in range(pc[i][0]):
                        if score >= G:
                            break
                        score += 100 * (i + 1)
                        tmp_answer += 1
            answer = min(answer,tmp_answer)
    print(answer)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p = [0]*d
c = [0]*d
for i in range(d):
  p[i], c[i] = map(int, input().split())
 
ans = 10**6
 
for i in range(2**d):
  cnt = 0
  sum = 0
  k = -1
  for j in range(d):
    if (i >> j) & 1:
      sum += (j+1)*100*p[j]+c[j]
      cnt += p[j]
    else:
      k = j
  if sum < g:
    s1 = 100 * (k + 1)
    need = (g - sum + s1 - 1) // s1
    if need >= p[k]:
      continue
    cnt += need
    ans = min(ans, cnt)
print(ans)

Submission status: Wrong Answer

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

d, g = map(int, input().split())

p = [0] * d
c = [0] * d

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

ans = 100000

sum = 0
k = 0

for i in range(2 ** d):
    cnt = 0
    sum = 0


    for j in range(d):

        if (i >> j) & 1:
            sum += 100 * p[j] * (j + 1) + c[j]
            cnt += p[j]
    # print(i, bin(i), j, cnt, sum)

    if sum >= g and ans > cnt:
        ans = cnt
        continue

    if g > sum:
        # print(ans, cnt, sum)
        ans = cnt
        for j in reversed(range(d)):
            if not (i >> j) & 1:
                k = j
                # print(sum, i, k)
                break

        if g - sum > (100 * (k + 1)) * p[k]:
            continue

        if g - sum <= (100 * (k + 1)) * p[k]:

            ans += (g - sum - 1) // (100 * (k + 1)) + 1

print(ans)

Submission status: Wrong Answer

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

d, g = map(int, input().split())

p = [0] * d
c = [0] * d

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

ans = 100000

sum = 0
k = 0

for i in range(2 ** d):
    cnt = 0
    sum = 0


    for j in range(d):

        if (i >> j) & 1:
            sum += 100 * p[j] * (j + 1) + c[j]
            cnt += p[j]
    print(i, bin(i), j, cnt, sum)

    if sum >= g and ans > cnt:
        ans = cnt
        continue

    if g > sum:
        # print(ans, cnt, sum)
        ans = cnt
        for j in reversed(range(d)):
            if not (i >> j) & 1:
                k = j
                # print(sum, i, k)
                break

        if g - sum > (100 * (k + 1)) * p[k]:
            continue

        if g - sum <= (100 * (k + 1)) * p[k]:

            ans += (g - sum - 1) // (100 * (k + 1)) + 1

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import math

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

min_cnt = 10 ** 10
for x in itertools.product([0, 1], repeat = d):
	sum_score = sum([((i + 1) * 100 * ps[i] + cs[i]) * x[i] for i in range(d)])
	cnt = sum([ps[i] * x[i] for i in range(d)])

	if sum_score >= g:
		min_cnt = min(min_cnt, cnt)
		continue

	for i in reversed(range(d)):
		if x[i] == 0:
			k = min(math.floor((g - sum_score) / ((i + 1) * 100)), ps[i])
			sum_score += k * (i + 1) * 100
			cnt += k
			break
	
	if sum_score >= g:
		min_cnt = min(min_cnt, cnt)

print(min_cnt)

Submission status: Wrong Answer

Solution code:
import math
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)
  
ans = []  
def solve(s):
  global ans
  if len(s) == d:
    total = 0
    cnt = 0
    for i in range(len(s)):
      total += int(s[i]) * (ps[i]*(i+1)*100 + cs[i]) #全部解いたときの点
      cnt += int(s[i]) * ps[i]
    if total >= g:
      #return cnt
      ans.append(cnt)
      return
    else:
      #解いていない中で得点が最大の問題を探す
      s = s[::-1]
      idx = s.find("0")
      if s == -1:
        return
      #溶けるだけ解いてgを超えるならおk
      if math.ceil((g-total) //  ((d-idx)*100)) < ps[d-1-idx]:
        cnt += math.ceil((g-total) //  ((d-idx)*100))
        #return cnt
        ans.append(cnt)
        return
      else:
        #return 0
        return
      return
  solve(s+"0")
  solve(s+"1")

  
solve("")
print(min(ans))

Submission status: Wrong Answer

Solution code:
import math
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)
  
ans = []  
def solve(s):
  global ans
  if len(s) == d:
    total = 0
    cnt = 0
    for i in range(len(s)):
      total += int(s[i]) * (ps[i]*(i+1)*100 + cs[i]) #全部解いたときの点
      cnt += int(s[i]) * ps[i]
    if total >= g:
      #return cnt
      ans.append(cnt)
      return
    else:
      #解いていない中で得点が最大の問題を探す
      s = s[::-1]
      idx = s.find("0")
      #溶けるだけ解いてgを超えるならおk
      if math.ceil((g-total) //  ((d-idx)*100)) < ps[d-1-idx]:
        cnt += math.ceil((g-total) //  ((d-idx)*100))
        #return cnt
        ans.append(cnt)
        return
      else:
        #return 0
        return
      return
  solve(s+"0")
  solve(s+"1")

  
solve("")
print(min(ans))

Submission status: Wrong Answer

Solution code:
import math
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)
  
ans = []  
def solve(s):
  global ans
  if len(s) == d:
    total = 0
    cnt = 0
    for i in range(len(s)):
      total += int(s[i]) * (ps[i]*(i+1)*100 + cs[i])
      cnt += int(s[i]) * ps[i]
    if total >= g:
      #return cnt
      ans.append(cnt)
      return
    else:
      #解いていない中で得点が最大の問題を探す
      s = s[::-1]
      idx = s.find("0")
      #溶けるだけ解いてgを超えるならおk
      if math.ceil((g-total) //  ((d-idx)*100)) <= ps[d-1-idx]:
        cnt += math.ceil((g-total) //  ((d-idx)*100))
        #return cnt
        ans.append(cnt)
        return
      else:
        #return 0
        return
      return
  solve(s+"0")
  solve(s+"1")

  
solve("")
print(min(ans))

Submission status: Wrong Answer

Solution code:
import math
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)
  
ans = []  
def solve(s):
  global ans
  if len(s) == d:
    total = 0
    cnt = 0
    for i in range(len(s)):
      total += int(s[i]) * (ps[i]*(i+1)*100 + cs[i])
      cnt += int(s[i]) * ps[i]
    if total >= g:
      #return cnt
      ans.append(cnt)
      return
    else:
      #解いていない中で得点が最大の問題を探す
      s = s[::-1]
      idx = s.find("0")
      #溶けるだけ解いてgを超えるならおk
      if math.ceil((g-total) //  ((d-idx)*100)) <= ps[d-1-idx]:
        cnt += math.ceil((g-total) //  ((d-idx)*100))
        #return cnt
        ans.append(cnt)
        return
      else:
        #return 0
        return
  solve(s+"0")
  solve(s+"1")

  
solve("")
print(min(ans))

Submission status: Wrong Answer

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

N = []
C = []
for _ in range(D):
    n, c = map(int, input().split())
    N.append(n)
    C.append(c)


min_answered = 100**D + 5


# それぞれの配点の問題を完全に解くか、全く解かないかを決定する
for i in range(pow(2, D)):

    points = 0
    n_answered = 0
    rest_i = []  # 完全に解かない問題

    for j in range(D):
        # 2進数とした時、1であれば完全に解くとする
        if (i >> j) & 1:
            points += N[j] * (j+1) * 100 + C[j] # 問題数 x 配点 + ボーナス
            n_answered += N[j]

        # 全く解かない
        else:
            rest_i.append(j)


    # 全ての問題を解いた場合は終了とする
    if not rest_i:
        continue

    # 目標に満たない場合、解いていない最大配点問題を中途半端に解く
    max_i = max(rest_i)  # 未完問題の最大添え字
    max_n = N[max_i]     # 未完最大配点問題の問題数
    max_p = 100 * (max_i + 1)  # 未完最大配点問題の点数

    while points < G and max_n > 0:
        points += max_p
        n_answered += 1
        max_n -= 1

    # 目標を満たす場合のみ最小問題数を更新する
    if points >= G:
        min_answered = min(min_answered, n_answered)

print(min_answered)

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)
ans =100000
for i in range(2**d):
    score=0
    cnt=0
    other=[]
    bina = format(i,"b").zfill(d)
    for j in range(len(bina)):
        if bina[j]=="1":
            score += p[j]*100*(j+1) + c[j]
            cnt+=p[j]
        else:
            other.append(j)
    if score<g:
        x = g-score
        k = other[-1]
        if (p[k]-1)*(k+1)*100<x:
            continue
        cnt += x//(100*(k+1))
    ans = min(ans,cnt)
print(ans)

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)
ans =100000
for i in range(2**d):
    score=0
    cnt=0
    other=[]
    bina = format(i,"b").zfill(d)
    for j in range(len(bina)):
        if bina[j]=="1":
            score += p[j]*100*(j+1) + c[j]
            cnt+=p[j]
        else:
            other.append(j)
    if score<g:
        x = g-score
        k = other[-1]
        if (p[k]-1)*(j+1)*100<x:
            continue
        cnt += x//(100*(k+1))
    ans = min(ans,cnt)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
from collections import defaultdict as dd

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

for i in range(D):
    sumd.append((i+1) * 100 * p[i] + c[i])
    d.append(((i+1) * 100 * p[i] + c[i])/p[i])

temp = 0
temp_i = 0
lis = list(range(D))
rest_sum = G
count = 0
while(rest_sum > 0):
    for i in lis:
        if d[i] >= temp:
            temp = d[i]
            temp_i = i
    if sumd[temp_i] < rest_sum:
        rest_sum -= sumd[temp_i]
        lis.remove(temp_i)
        temp = 0
        count += p[temp_i]
    else:
        while(rest_sum > 0):
            max_i = max(lis)
            if rest_sum >= p[max_i] * 100 * (max_i+1) and rest_sum <= sumd[max_i]:
                count += p[max_i]
                rest_sum -= sumd[max_i]
            elif rest_sum < p[max_i] * 100 * (max_i+1):
                count += math.ceil(rest_sum/((max_i+1) * 100))
                rest_sum -= p[max_i] * 100 * (max_i+1)
            else:
                rest_sum -= p[max_i] * 100 * (i+1)
                lis.remove(max_i)
                count += p[max_i]

print(count)

Submission status: Wrong Answer

Solution code:
import numpy as np
d, g = map(int, input().split())
p_list = [list(map(int, input().split())) for i in range(d)]
count_list = [0] * len(p_list)
max_list = [0] * len(p_list)

res = g
pos = d
for pos in range(d,0,-1):
  if res > 0:
    if p_list[pos-1][0] * pos * 100 + p_list[pos-1][1] < res:
      count_list[pos-1] = p_list[pos-1][0]
      res = res - (p_list[pos-1][0] * pos * 100 + p_list[pos-1][1])
      pos -= 1
    elif (p_list[pos-1][0]-1) * pos * 100 < res:
      count_list[pos-1] = (p_list[pos-1][0]-1)
      res = res - (p_list[pos-1][0]-1) * pos * 100
      pos -= 1
    else:
      count_list[pos-1] = int(np.ceil(res /(100*pos)))
      res = res - int(np.ceil(res /(100*pos))) * pos * 100
      pos -= 1

print(np.sum(count_list))

Submission status: Wrong Answer

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    if ck == []:
      continue
    ckm = max(ck)
    for k in range(PC[ckm][0]):
      t += (ckm+1)*100
      c += 1
      if t >= G:
        l.append(c)
        break
      
print(min(l))

Submission status: Wrong Answer

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append([c,int(i),t-G])
    
l2 = []
b = min(l)
for j in range(D):
  ct = 0
  if ((b[1] >> j) & 1):
    if b[2] >= PC[j][1]+(j+1)*100:
      b[2] -= PC[j][1]+(j+1)*100
      ct += 1
      while b[2] > (j+1)*100:
        b[2] -= (j+1)*100
        ct += 1
    l2.append(ct)
    
print(b[0]-max(l2))

Submission status: Wrong Answer

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append([c,int(i),t-G])
    
ct = 0
l2 = []
b = min(l)
for j in range(D):
  ct = 0
  if ((b[1] >> j) & 1):
    if b[2] <= PC[j][1]+(j+1)*100:
      b[2] -= PC[j][1]+(j+1)*100
      ct += 1
      while b[2] > (j+1)*100:
        b[2] -= (j+1)*100
        ct += 1
    l2.append(ct)
    
print(b[0]-max(l2))

Submission status: Wrong Answer

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append([c,int(i),t-G])
    
ct = 0
b = min(l)
for j in range(D):
  if ((b[1] >> j) & 1):
    if b[2] <= PC[j][1]+(j+1)*100:
      b[2] -= PC[j][1]+(j+1)*100
      ct += 1
      while b[2] > (j+1)*100:
        b[2] -= (j+1)*100
        ct += 1
    
print(b[0]-ct)

Submission status: Wrong Answer

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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)

print(min(l))

Submission status: Wrong Answer

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]

count = 0
for j in range(D):
  count += PC[j][0]
  
PC1.sort()
accum = 0
ans = 0
for i in range(count):
  if G - accum < D * (PC[D-1][0]-1):
    for j in range(PC[D-1][0]-1):
      accum += D*100
      ans += 1
      if accum >= G:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = [int(i) for i in input().split()]
p = []
c = []
for i in range(d):
    x, y = [int(_) for _ in input().split()]
    p.append(x)
    c.append(y)

ba = [[0, [0 for _ in range(d)]] for _ in range(d*100)]
cnt = 1
while True:
    max_score = 0
    pat = [0 for _ in range(d)]
    for i in range(cnt//2):
        flag = True
        tmp_pat = [0 for _ in range(d)]
        for j in range(d):
            tmp_pat[j] = ba[i][1][j] + ba[cnt-i-2][1][j]
            if ba[i][1][j] + ba[cnt-i-2][1][j] > p[j]:
                flag = False
        if flag:
            score = ba[i][0] + ba[cnt-i-2][0]
            if score > max_score:
                max_score = score
                pat = tmp_pat
    if cnt in p:
        j = p.index(cnt)
        score = 100 * (j+1) * p[j] + c[j]
        if score > max_score:
            max_score = score
            pat = [0 for _ in range(d)]
            pat[j] = p[j]
            
    tmp_pat = [0 for _ in range(d)]
    for k in range(d-1, -1, -1):
        if ba[cnt-2][1][k] < p[k]:
            key = k
            break
    if cnt > 1:
        score = ba[cnt-2][0] + (key+1)*100
        tmp_pat = ba[cnt-2][1]
        if ba[cnt-2][1][key]+1 == p[key]:
            score += c[key]
    else:
        score = (key+1)*100
    tmp_pat[key] += 1
    if score > max_score:
        max_score = score
        pat = tmp_pat

    ba[cnt-1][0] = max_score
    ba[cnt-1][1] = pat
    if max_score >= g:
        break
    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
d, g = [int(i) for i in input().split()]
p = []
c = []
for i in range(d):
    x, y = [int(_) for _ in input().split()]
    p.append(x)
    c.append(y)

ans = 1
key = d-1
score_max = 0
cnt = 1
pat = [0 for i in range(d)]
while True:
    while pat[key] >= p[key]:
        key -= 1  
    pat[key] += 1
    if pat[key] == p[key]:
        score_max += c[key]        
    score_max += (key+1) * 100

    if cnt in p:
        i = p.index(cnt)
        score = 100*(i+1)*p[i]+c[i]
        if score > score_max:
            score_max = score
            pat = [0 for i in range(d)]
            pat[i] = p[i]
            key = d -1
    if score_max >= g:
        break
    cnt += 1
print(cnt)

Submission status: Wrong Answer

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]

count = 0
for j in range(D):
  count += PC[j][0]
  
PC1.sort()
accum = 0
ans = 0
for i in range(count):
  for j in range(PC1[i][1]):
    accum += PC1[i][2]
    ans += 1
    if j == PC1[i][1]-1:
      accum += PC1[i][3]
    if accum >= G:
      print(ans)
      exit()
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p = []
c = []
for i in range(d):
    e1, e2 = map(int, input().split())
    p.append(e1)
    c.append(e2)


ans = float('inf')
for i in range(2**d):
    total = 0
    num = 0
    for j in range(d):
        if (i >> j) & 1:
            total += c[-(j+1)] + p[-(j+1)] * (d - j) * 100
            num += p[-(j+1)]
    if total >= g:
        ans = min(ans, num)
    else:
        for j in range(d):
            if (i >> j) & 1:
                continue
            for k in range(p[-(j+1)]):
                total += (d-j) * 100
                num += 1
                if total >= g:
                    break
    ans = min(ans, num)

print(ans)