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)]
A=[0 for i in range(D)]  
m=10**18

for i in range(1,2**D):
  c=s=0
  for j in range(D):
    A[j]=(i>>j) & 1
    if (i>>j) & 1: #j番目の問題を完全に解く
      s += p[j][0]*(j+1)*100+p[j][1]
      c += p[j][0]
  #print(A,i,s,c,m)
  if s>=G:
    if sum(A) == 1:
      c=min( ( G + (G % (100*(j+1)))) // ((j+1)*100), c)
  else:
    B=map(str,A)
    n=("".join(B)).rfind("0") #中途半端にとくやつを決める
    #print(A,n)
    lest=( (G-s) + (G-s)%((n+1)*100) )//((n+1)*100) 
    #print("lest:",lest)
    if lest > p[n][0]:
      continue
    c += lest
  m=min(m,c)
print(m)

Submission status: Wrong Answer

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

ans = float("INF")
for mask in range(1 << d):
  tmp = 0
  tmp1 = 0
  for j in range(d):
    if 1 << j & mask:
      tmp += pd[j][1]
      tmp += pd[j][0] * 100 * (j + 1)
      tmp1 += pd[j][0]
  if tmp >= g:
    ans = min(ans, tmp1)
    continue
  for j in range(d-1,-1,-1):
    if not(1 << j & mask):
      if tmp + pd[j][0] * 100 * (j + 1) >= g:
        tmp1 += (g - tmp) // (100 * (j + 1))
        tmp = g
        break
      tmp1 += pd[j][0]
      tmp += pd[j][0] * 100 * (j + 1)
  if tmp >= g:
    ans = min(ans, tmp1)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

INF = sys.maxsize
D, G = map(int, input().split())

class P:
  def __init__(self, index, number, bonus):
    self.index = index
    self.number = number
    self.bonus = bonus
    
  @property
  def score(self):
    return (self.index + 1) * 100
   
  @property
  def complete_score(self):
    return self.score * self.number + self.bonus
  
  # score 獲得するのに必要な解答数
  def cost_of(self, score):
    if score > self.complete_score:
      return INF
    if score == 0:
      return 0
    return min(score // self.score, self.number)
  
problems = []
for i in range(D):
  p, c = map(int, input().split())
  problems.append(P(i, p, c))
  
min_number_of_solved = INF

for m in range(1 << D):
  total = 0
  number_of_solved = 0
  uncompleted = set()
  
  for i, p in enumerate(problems):
    if 1 << i & m:  # 完答
      total += p.complete_score
      number_of_solved += p.number
    else:
      uncompleted.add(p)

  # 他の問題を解かなくても条件を満たしている
  if total >= G:
    min_number_of_solved = min(
      min_number_of_solved, 
      number_of_solved
    )
  # 残りの必要点数を最小コストで獲得できる問題を中途半端に解く
  else:
    # 不足する点を最小コストで獲得できる問題を探す
    m = min(uncompleted, key=lambda x: x.cost_of(G - total))
    
    min_number_of_solved = min(
      min_number_of_solved, 
      number_of_solved + m.cost_of(G - total)
    )
                   
print(min_number_of_solved)

Submission status: Wrong Answer

Solution code:
import math

d,g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = 10 ** 18
for i in range(2 ** d):
  solve = []
  tmp = 0
  score = 0
  for j in range(d):
    solve.append((i >> j) & 1)
  for j in range(d):
    if not solve[j]:
       continue
    p,c = pc[j]
    tmp += p
    score += p * (j+1) * 100 + c
  if score >= g:
    ans = min(ans, tmp)
    continue
  res = g - score
  for j in range(d-1,-1,-1):
    if not solve[j]:
      point = (j+1) * 100
      p,c = pc[j]
      must = math.ceil(res / point)
      if must <= p:
        tmp += must
        ans = min(ans, tmp)
        continue
      else:
        res -= p * point + c
        tmp += p
        if res <= 0:
          ans = min(ans, tmp)
          continue
print(ans)

Submission status: Wrong Answer

Solution code:
import math

d,g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = 10 ** 18
for i in range(2 ** d):
  solve = []
  tmp = 0
  score = 0
  for j in range(d):
    solve.append((i >> j) & 1)
  for j in range(d):
    if not solve[j]:
       continue
    p,c = pc[j]
    tmp += p
    score += p * (j+1) * 100 + c
  if score >= g:
    ans = min(ans, tmp)
    continue
  res = g - score
  for j in range(d-1,-1,-1):
    if not solve[j]:
      point = (j+1) * 100
      p,c = pc[j]
      must = math.ceil(res / point)
      if must <= p:
        tmp += must
        ans = min(ans, tmp)
        continue
      else:
        res -= p * point + c
        tmp += p
        if res <= 0:
          tmp += p
          ans = min(ans, tmp)
          continue
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

A = []
for i in range(D):
    A.append(100*(i+1)*d[i][0] + d[i][1])

ans = 0
for i in range(D):
    ans += d[i][0]

for i in range(2**D):
    a = 0
    g = 0
    B = []
    for j in range(D):
        if (i >> j) & 1:
            a += A[j]
            g += d[j][0]
        else:
            B.append(j)
    b = 0
    for j in B:
        b = max(b,A[j])

    if G-b < a <= G:
        c = max(B)
        e = math.ceil((G-a)/(100*(c+1)))
        if e > d[c][0]:
            continue
        else:
            ans = min(ans,g+e)

print(ans)

Submission status: Wrong Answer

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

A = []
for i in range(D):
    A.append(100*(i+1)*d[i][0] + d[i][1])

ans = 0
for i in range(D):
    ans += d[i][0]

for i in range(2**D):
    a = 0
    g = 0
    B = []
    for j in range(D):
        if (i >> j) & 1:
            a += A[j]
            g += d[j][0]
        else:
            B.append(j)
    b = 0
    for j in B:
        b = max(b,A[j])

    if G-b < a <= G:
        c = max(B)
        e = (G-a)//(100*(c+1))
        if e > d[c][0]:
            continue
        else:
            ans = min(ans,g+e)

print(ans)

Submission status: Wrong Answer

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

A = []
for i in range(D):
    A.append(100*(i+1)*d[i][0] + d[i][1])

ans = 10000
for i in range(2**D):
    a = 0
    g = 0
    B = []
    for j in range(D):
        if (i >> j) & 1:
            a += A[j]
            g += d[j][0]
        else:
            B.append(j)
    b = 0
    for j in B:
        b = max(b,A[j])

    if G-b < a <= G:
        c = max(B)
        e = (G-a)//(100*(c+1))
        if e > d[c][0]:
            continue
        else:
            ans = min(ans,g+e)

print(ans)

Submission status: Wrong Answer

Solution code:
# ABC 104 C - All Green
d,g=map(int, input().split())
pc=[list(map(int,input().split())) for _ in range(d)]
ans=1<<(1<<5)
for bit in range(1<<d):
    num=0
    point=0
    nokori=set(range(1,d+1))
    
    for i in range(d):
        if bit&(1<<i):
            num+=pc[i][0]
            point+=(i+1)*100*pc[i][0]+pc[i][1]
            nokori.discard(i+1)
            
    if point<g:
        use=max(nokori)
        n=min(pc[use-1][0], (g-point)//(use*100))
        num+=n
        point+=n*use*100
    
    if point>=g:
        ans=min(ans, num)

print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 100**6
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g and ans > solved:
				ans = solved
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(1 << d):
			done = False
			t_solved = solved
			t_total = total
			for k in range(d-1, -1, -1):
				if (j >> k) & 1:
					if i == k:
						continue
					if done:
						break
					for _ in range(ps[k]):
						if done:
							break
						if t_total >= g and ans > t_solved:
							ans = t_solved
							done = True
							continue
						t_total += 100 * (k+1)
						t_solved += 1
					t_total += cs[k]
	print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 100**6
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g and ans > solved:
				ans = solved
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(1 << d):
			done = False
			t_solved = solved
			t_total = total
			for k in range(d-1, -1, -1):
				if (j >> k) & 1:
					if i == k:
						continue
					if done:
						break
					for _ in range(ps[k]):
						if done:
							break
						if t_total >= g and ans > t_solved:
							ans = t_solved
							done = True
							continue
						t_total += 100 * (k+1)
						t_solved += 1
					t_total += cs[k]
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 100**6
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g:
				if ans > solved:
					ans = solved
				break
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(d-1, -1, -1):
			if i == j:
				continue
			for _ in range(ps[j]):
				if total >= g:
					if ans > solved:
						ans = solved
					continue
				total += 100 * (j+1)
				solved += 1
			total += cs[j]
	print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 1000000
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g and ans > solved:
				ans = solved
				break
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(d-1, -1, -1):
			if i == j:
				continue
			for _ in range(ps[j]):
				if total >= g:
					if ans > solved:
						ans = solved
					continue
				total += 100 * (j+1)
				solved += 1
			total += cs[j]
	print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 1000000
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g and ans > solved:
				ans = solved
				break
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(d-1, -1, -1):
			if i == j:
				continue
			for _ in range(ps[j]):
				if total >= g and ans > solved:
					ans = solved
					continue
				total += 100 * (j+1)
				solved += 1
			total += cs[j]
	print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 1000000
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d-1, -1, -1):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g and ans > solved:
				ans = solved
				break
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g and ans > solved:
			ans = solved
			break
		for j in range(d-1, -1, -1):
			if i == j:
				continue
			for _ in range(ps[j]):
				if total >= g and ans > solved:
					ans = solved
					continue
				total += 100 * (j+1)
				solved += 1
			total += cs[j]
	print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
	d, g = map(int, input().split())
	ps = []
	cs = []
	ans = 1000000
	for _ in range(d):
		p, c = map(int, input().split())
		ps.append(p)
		cs.append(c)
	for i in range(d):
		total = 0
		solved = 0
		for _ in range(ps[i]):
			if total >= g and ans > solved:
				ans = solved
				continue
			total += 100 * (i + 1)
			solved += 1
		total += cs[i]
		if total >= g:
			ans = solved
			continue
		for j in range(d-1, -1, -1):
			if i == j:
				continue
			for _ in range(ps[j]):
				if total >= g:
					if ans > solved:
						ans = solved
					continue
				total += 100 * (j+1)
				solved += 1
			total += cs[j]
	print(ans)
resolve()

Submission status: Wrong Answer

Solution code:
INF = 10 ** 10

D, G = map(int, input().split())
pairs = [map(int, input().split()) for _ in range(D)]
ps, cs = zip(*pairs)

minimumsolve = INF

for i in range(1 << D):
    solve = 0
    score = 0
    for j in range(D):
        if i & 1 << j:
            solve += ps[j]
            score += ps[j] * 100 * (j+1) + cs[j]
    if score < G:
        for j in range(D-1, -1, -1):
            if not i & 1 << j:
                neededsolve = (G - score) // (100*(j+1)) + 1
                if neededsolve >= ps[j]:
                    solve = INF
                    break
                else:
                    solve += neededsolve
                    #score doesn't have to be updated
                    break
    minimumsolve = min(minimumsolve, solve)

print(minimumsolve)

Submission status: Wrong Answer

Solution code:
INF = 10 ** 10

D, G = map(int, input().split())
pairs = [map(int, input().split()) for _ in range(D)]
ps, cs = zip(*pairs)

minimumsolve = INF

for i in range(1 << D):
    solve = 0
    score = 0
    for j in range(D):
        if i & 1 << j:
            solve += ps[j]
            score += ps[j] * 100 * (j+1) + cs[j]
    if score < G:
        for j in range(D-1, -1, -1):
            if not i & 1 << j:
                neededsolve = (G - score) // (100*(j+1))
                if neededsolve >= ps[j]:
                    solve = INF
                    break
                else:
                    solve += neededsolve
                    #score doesn't have to be updated
                    break
    minimumsolve = min(minimumsolve, solve)

print(minimumsolve)

Submission status: Wrong Answer

Solution code:
INF = 10 ** 10

D, G = map(int, input().split())
pairs = [map(int, input().split()) for _ in range(D)]
ps, cs = zip(*pairs)

minimumsolve = INF

for i in range(1 << D):
    solve = 0
    score = 0
    for j in range(D):
        if i & 1 << j:
            solve += ps[j]
            score += ps[j] * 100 * (j+1) + cs[j]
    if score < G:
        for j in range(D-1, -1, -1):
            if not i & 1 << j:
                neededsolve = (G - score) // (100*(j+1))
                if neededsolve >= ps[j]:
                    solve = INF
                    break
                else:
                    solve += neededsolve
                    #score doesn't have to be updated
                    break
    minimumsolve = min(minimumsolve, solve)

print(minimumsolve)

Submission status: Wrong Answer

Solution code:
INF = 10 ** 10

D, G = map(int, input().split())
pairs = [map(int, input().split()) for _ in range(D)]
ps, cs = zip(*pairs)

minimumsolve = INF

for i in range(1 << D):
    solve = 0
    score = 0
    for j in range(D):
        if i & 1 << j:
            solve += ps[j]
            score += ps[j] * 100 * (j+1) + cs[j]
    if score < G:
        for j in range(D-1, -1, -1):
            if not i & 1 << j:
                neededsolve = (G - score) // (100*(j+1))
                if neededsolve >= ps[j]:
                    solve = INF
                    break
                else:
                    solve += neededsolve
                    #score doesn't have to be updated
    minimumsolve = min(minimumsolve, solve)

print(minimumsolve)

Submission status: Wrong Answer

Solution code:
_lst = input().split()
d = int(_lst[0])
g = int(_lst[1])

pc = list()

for i in range(d):
    _lst = input().split()
    pc.append((int(_lst[0]), int(_lst[1])))

score = 0
result_count = -1

# 全て回答したパターンを探索する
for i in range(2 ** d):
    count = 0
    score = 0

    # 全問正解した配点のスコアを足す
    for j in range(d):
        if i >> j & 1:
            score += 100 * (j + 1) * pc[j][0] + pc[j][1]
            count += pc[j][0]

    # すでに配点を超えている場合は、最小のcountだけ考慮して処理終了
    if score >= g:
        if result_count >= count or result_count == -1:
            result_count = count
        continue

    not_reach = True
    for j in range(d-1, -1, -1):
        if not (i >> j & 1):  # 全問正解していない配点(一番大きい0)のindexを特定
            if -((score - g) // ((j + 1) * 100)) < pc[j][0]:  # 配点が全問正解しないでも目標値を超えるか確認
                count -= (score - g) // ((j + 1) * 100)  # 全問正解していない配点の正解数
                not_reach = False

    # gに届かなかった場合は考慮しない
    if not_reach:
        continue

    if result_count >= count or result_count == -1:
        result_count = count

print(result_count)

Submission status: Wrong Answer

Solution code:
_lst = input().split()
d = int(_lst[0])
g = int(_lst[1])

pc = list()

for i in range(d):
    _lst = input().split()
    pc.append((int(_lst[0]), int(_lst[1])))

score = 0
result_count = -1

# 全て回答したパターンを探索する
for i in range(2 ** d):
    count = 0
    score = 0

    # 全問正解した配点のスコアを足す
    for j in range(d):
        if i >> j & 1:
            score += 100 * (j + 1) * pc[j][0] + pc[j][1]
            count += pc[j][0]

    # すでに配点を超えている場合は、最小のcountだけ考慮して処理終了
    if score >= g:
        if result_count >= count or result_count == -1:
            result_count = count
        continue

    not_reach = True
    for j in range(d-1, -1, -1):
        if not (i >> j & 1):  # 全問正解していない配点(一番大きい0)のindexを特定
            if (g - score) // ((j + 1) * 100) < pc[j][0]:  # 配点が全問正解しないでも目標値を超えるか確認
                count -= (score - g) // ((j + 1) * 100)  # 全問正解していない配点の正解数
                not_reach = False

    # gに届かなかった場合は考慮しない
    if not_reach:
        continue

    if result_count >= count or result_count == -1:
        result_count = count

print(result_count)

Submission status: Wrong Answer

Solution code:
_lst = input().split()
d = int(_lst[0])
g = int(_lst[1])

pc = list()

for i in range(d):
    _lst = input().split()
    pc.append((int(_lst[0]), int(_lst[1])))

score = 0
result_count = 0
tmp = 0

# 全て回答したパターンを探索する
for i in range(2 ** d):
    count = 0
    score = 0

    # 全問正解した配点のスコアを足す
    for j in range(d):
        if i >> j & 1:
            score += 100 * (j + 1) * pc[j][0] + pc[j][1]
            count += pc[j][0]

    # すでに配点を超えている場合は、最小のcountだけ考慮して処理終了
    if score > g:
        if result_count >= count or result_count == 0:
            result_count = count
        continue

    not_reach = True
    for j in range(d-1, -1, -1):
        if not (i >> j & 1):  # 全問正解していない配点(一番大きい0)のindexを特定
            if (g - score) // ((j + 1) * 100) < pc[j][0]:  # 配点が全問正解しないでも目標値を超えるか確認
                count -= (score - g) // ((j + 1) * 100)  # 全問正解していない配点の正解数
                not_reach = False

    # gに届かなかった場合は考慮しない
    if not_reach or count == 0:
        continue

    if result_count >= count or result_count == 0:
        result_count = count

print(result_count)

Submission status: Wrong Answer

Solution code:
_lst = input().split()
d = int(_lst[0])
g = int(_lst[1])

pc = list()

for i in range(d):
    _lst = input().split()
    pc.append((int(_lst[0]), int(_lst[1])))

score = 0
result_count = 0
tmp = 0

# 全て回答したパターンを探索する
for i in range(2 ** d):
    count = 0
    score = 0

    # 全問正解した配点のスコアを足す
    for j in range(d):
        print(i >> j, i >> j & 1)
        if i >> j & 1:
            score += 100 * (j + 1) * pc[j][0] + pc[j][1]
            count += pc[j][0]

    # すでに配点を超えている場合は、最小のcountだけ考慮して処理終了
    if score > g:
        if result_count >= count or result_count == 0:
            result_count = count
        continue

    not_reach = True
    for j in range(d-1, -1, -1):
        if not (i >> j & 1):  # 全問正解していない配点(一番大きい0)のindexを特定
            if (g - score) // ((j + 1) * 100) < pc[j][0]:  # 配点が全問正解しないでも目標値を超えるか確認
                count -= (score - g) // ((j + 1) * 100)  # 全問正解していない配点の正解数
                not_reach = False

    # gに届かなかった場合は考慮しない
    if not_reach or count == 0:
        continue

    if result_count >= count or result_count == 0:
        result_count = count

print(result_count)

Submission status: Wrong Answer

Solution code:
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], (g - sum) // (use * 100))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})


d, g = 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:
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], (g - sum) // (use * 100))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})

d, g = 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:
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], abs((g - sum) // (use * 100)))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})


d, g = 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:
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], (g - sum) // (use * 100))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})


d, g = 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 sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

D, G = map(int, readline().split())
problems = []
for i in range(1, D+1):
    p, c = map(int, readline().split())
    score = 100 * i
    problems.append({
        "score": score,
        "number": p,
        "bonus": c,
        "sum": score * p + c
    })

keta = len(problems)
answer = float("inf")
for i in range(0, 2 ** D):
    bits = list(str(format(i, "0{}b".format(keta))))
    sum_number = 0
    sum_score = 0
    half_index = None
    for j, is_full in enumerate(bits):
        if is_full == "1":
            sum_number += problems[j]["number"]
            sum_score += problems[j]["sum"]
        else:
            half_index = j
    if half_index is None:
        continue
    for _ in range(problems[half_index]["number"]):
        if sum_score >= G:
            break
        sum_score += problems[half_index]["score"]
        sum_number += 1
    if sum_score >= G:
        answer = min(answer, sum_number)

print(answer)

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

D, G = map(int, readline().split())
problems = []
for i in range(1, D+1):
    p, c = map(int, readline().split())
    score = 100 * i
    problems.append({
        "score": score,
        "number": p,
        "bonus": c,
        "sum": score * p + c
    })

keta = len(problems)
answer = float("inf")
for i in range(0, 2 ** D):
    bits = list(str(format(i, "0{}b".format(keta))))
    sum_number = 0
    sum_score = 0
    half_index = None
    for j, is_full in enumerate(bits):
        if is_full == "1":
            sum_number += problems[j]["number"]
            sum_score += problems[j]["sum"]
        else:
            half_index = j
    if half_index is None:
        continue
    for _ in range(problems[half_index]["number"]):
        if sum_score >= G:
            break
        sum_score += problems[half_index]["score"]
        sum_number += 1
    if sum_score >= G:
        answer = min(answer, sum_number)
        break

print(answer)

Submission status: Wrong Answer

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

D, G = map(int, readline().split())
problems = []
for i in range(1, D+1):
    p, c = map(int, readline().split())
    score = 100 * i
    problems.append({
        "score": score,
        "number": p,
        "bonus": c,
        "sum": score * p + c
    })

keta = len(problems)
answer = float("inf")
for i in range(0, 2 ** D):
    bits = list(str(format(i, "0{}b".format(keta))))
    sum_number = 0
    sum_score = 0
    half_index = None
    for j, is_full in enumerate(bits):
        if is_full == "1":
            sum_number += problems[j]["number"]
            sum_score += problems[j]["sum"]
        else:
            half_index = j
    # print("sum_score: {} sum_number: {}".format(sum_score, sum_number))
    if half_index is None:
        continue
    for _ in range(problems[half_index]["number"]):
        if sum_score >= G:
            answer = min(answer, sum_number)
            break
        sum_score += problems[half_index]["score"]
        sum_number += 1

print(answer)

Submission status: Wrong Answer

Solution code:
n, s = map(int, input().split())
data = []
for i in range(1,n+1):
    k, v = map(int, input().split())
    for j in range(1,k+1):
        if j<k:
            data.append([j,j*i*100])
        else:
            data.append([j,j*i*100+v])
m = len(data)
kekka = {}
for i in range(2 ** m):
    bag = []
    prob = []
   
    for j in range(m):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            bag.append(data[j][1]) # フラグが立っていたら bag に果物を詰める
            prob.append(data[j][0])
    if sum(bag) >= s:
        kekka[sum(prob)] = sum(bag)
min(kekka.items(), key = lambda x:x[1])[0]

Submission status: Wrong Answer

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

ans = float('inf')

for bit in range(1<<d):
  sum = 0
  cnt = 0
  rem = set([x for x in range(d)])
  for i in range(d):
    if bit & 1<<i:
      sum += pc[i][0]*(i+1)*100 + pc[i][1]
      cnt += pc[i][0]
      rem.discard(i)
    
  if sum < g:
    u = max(rem)
    n = min(pc[u][0],  -(-((g-sum)//((u+1)*100))))
    cnt += n
    sum += n*(u+1)*100
    
  if sum >= g:
    ans = min(ans, cnt)
    

print(ans)

Submission status: Wrong Answer

Solution code:
import  itertools

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

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

ans=float('inf')

def judge(tmp):
    ss=g
    count=0
    for i in range(d):
        if tmp[i]==1:
            ss-=(i+1)*p[i]*100+c[i]
            count+=p[i]
    if ss>0:
        for i in range(d-1,0,-1):
            if tmp[i]==0:
                if ss<=(i+1)*100*p[i]:
                    if ss%(i+1)*100:
                        count+=ss//((i+1)*100)
                    else:
                        count+=(ss//(i+1)*100)+1
                else:
                    count+=p[i]
                    ss-=(i+1)*100*p[i]+c[i]
    return  count

nums=[0,1]
for sd in itertools.product(nums,repeat=d):
    pat=list(sd)
    sdf=judge(pat)
    ans=min(ans,sdf)

print(ans)