Problem:


Score : 300 points

Problem Statement

A programming competition site AtCode provides algorithmic problems.
Each problem is allocated a score based on its difficulty.
Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.
These p_1 + … + p_D problems are all of the problems available on AtCode.

A user of AtCode has a value called total score.
The total score of a user is the sum of the following two elements:

Base score: the sum of the scores of all problems solved by the user.

Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).

Takahashi, who is the new user of AtCode, has not solved any problem.
His objective is to have a total score of G or more points.
At least how many problems does he need to solve for this objective?

Constraints

1 ≤ D ≤ 10

1 ≤ p_i ≤ 100

100 ≤ c_i ≤ 10^6

100 ≤ G

All values in input are integers.

c_i and G are all multiples of 100.

It is possible to have a total score of G or more points.

Input

Input is given from Standard Input in the following format:

D G
p_1 c_1
:
p_D c_D

Output

Print the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).

Sample Input 1

2 700
3 500
5 800

Sample Output 1

3

In this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.

One way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.

Sample Input 2

2 2000
3 500
5 800

Sample Output 2

7

This case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.

Sample Input 3

2 400
3 500
5 800

Sample Output 3

2

This case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.

Sample Input 4

5 25000
20 1000
40 1000
50 1000
30 1000
1 1000

Sample Output 4

66

There is only one 500-point problem, but the perfect bonus can be earned even in such a case. 



Sample input:
2 700
3 500
5 800


Sample output:
3

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
INF = float("inf")
import sys

D,G = map(int,sys.stdin.readline().split())
pc = tuple(list(map(int,sys.stdin.readline().rstrip().split())) for _ in range(D)) # multi line with multi param

s = sum(p for p,c in pc)

def backtrack(i,t):
    #print(i,t,pc)
    if i == s:
        return INF
    if t >= G:
        return i
    ret = INF
    for j in range(D):
        if pc[j][0] > 0:
            pc[j][0] -= 1
            if pc[j][0] == 0:
                ret = min(ret,backtrack(i+1,t+(j+1)*100+pc[j][1]))
            elif pc[j][0] > 0:
                ret = min(ret,backtrack(i+1,t+(j+1)*100))
            pc[j][0] += 1
    return ret
print(backtrack(0,0))

Submission status: Wrong Answer

Solution code:
def main():
    d,g = map(int,input().split())
    ls = []
    for i in range(d):
        p,c = map(int,input().split())
        q = [100*(i+1) for j in range(p)]
        q[-1] += c
        ls.append(q)
    s,cnt,keep = 0,0,0
    while s<g:
        m = 0
        for i in range(d):
            if len(ls[i])>0:
                if m<ls[i][0]:
                    m = ls[i][0]
                    keep = i
        ls[keep].pop(0)
        s += m
        cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
d,g=map(int,input().split())
g=g//100
pc=[list(map(int,input().split())) for _ in range(d) ]
s=[0]*d
for i in range(d):
    p,c=pc[i]
    s[i]=(i+1)*p+c//100
n=2**d
ans=10**4
for i in range(1,n):
    res=0
    q=0
    for j in range(d):
        if i & (1<<j):
            res+=s[j]
            q+=pc[j][0]
    if g>res:
        q_b=q
        for j in range(d):
            if i & (1<<j):
                continue
            else:
                if (g-res)//(j+1)<pc[j][0]:
                    q_b=q+math.ceil((g-res)/(j+1))
                    ans=min(ans,q_b)
    else:
        ans=min(ans,q)
print(ans)

Submission status: Wrong Answer

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

li = [list(map(int,input().split())) for _ in range(D)]


ten = 0
c = 0
kei = 0

for i,k in enumerate(li[::-1]):
    for j in range(k[0]):
        ten += 100*(D-i)
        c+=1
        if j==k[0]-1:
            ten += k[1]
        if ten>=G:
            kei = c
            break
    else:continue
    break
     
num_min = 1001
ten2 = 0

for i in range(2**D):
    num_i = 0
    ten_i = 0
    for j in range(D):
        if (i>>j) & 1:
            num_i += li[j][0]
            ten_i += li[j][1]
    if ten_i < G:continue
    if num_i <= num_min:
        num_min=num_i
        ten2 = ten_i

if num_min < c:
    print(num_min)
else:print(c)

Submission status: Wrong Answer

Solution code:
d , g = map(int,input().split())
poi = [tuple(map(int,input().split())) for i in range(d)]
ans = 10**5
for i in range(2**d):
    cou = 0
    ten = 0
    for j in range(d):
        if i >> j & 1 == 1:
            cou += poi[j][0]
            ten += poi[j][1] + (j+1)*100*poi[j][0]
    for j in reversed(range(d)):
        if ten >= g:
            break
        if i >> j & 1 != 1:
            if g - ten > (j+1)*100*(poi[j][0]-1):
                cou += poi[j][0] - 1
                ten += (j+1)*100*(poi[j][0]-1)
            elif g - ten <= (j+1)*100*(poi[j][0]-1):
                cou += -(ten-g)//((j+1)*100)
                ten = g
                break
    if ten >= g:
        ans = min(ans,cou)
print(ans)

Submission status: Wrong Answer

Solution code:
# 方針〜
# Dが10以下なのがポイント
# 全ての部分集合に対して「この集合を全問解いた場合、総合スコアをG点以上にするために何問解くか」をビット全探索すれば良い。
# Dividing Chocolate (ABC159-E)と似たようなもの

# なお、「この集合を全問解いた場合、総合スコアをG点以上にするために何問解くか」を解くときには
# 得点の高い方からGreedyだが、途中でコンプリートした時のボーナスを無視しても正しい答えは出せる。
# それ自体のスコアは間違いになるが、問題数が増える方向に間違うし、正しい部分集合のときには正しい問題数が得られるので。
# 今回は上記の方法でやってみる。

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

ans = 10 ** 6 * 10 * 2
for completed in range(2 ** d):
    
    point_all = 0
    num_problem = 0

    # 最下位のdigitが100点問題
    for point in range(d):
        if (completed & 2 ** point) > 0:
            point_all += 100 * (point+1) * problems[point][0]
            point_all += problems[point][1]
            num_problem += problems[point][0]
    
    if point_all < goal:
        for point in reversed(range(d)):
            if (completed & 2 ** point) == 0:
                p = (100 * (point+1))
                n = (goal - point_all + p - 1) // p
                n = min(problems[point][0], n)

                point_all += n * p  # ボーナス点は無視する
                num_problem += p

                if point_all > goal:
                    break

    # 目標点数を達成しているとは限らないことに注意 条件に目標達成を入れる
    if point_all >= goal and num_problem < ans:
        ans = num_problem

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
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 = INF
for i in range(1 << D):
    points = 0
    solved = 0
    for j in range(D):
        if i & 1 << j > 0:
            points += C[j]
            points += P[j] * (j + 1) * 100
            solved += P[j]

    left = G - points
    for j in range(D - 1, -1, -1):
        if left <= 0:
            break
        if i & 1 << j > 0:
            continue
        val = min(100 * (j + 1) * (P[j] - 1), left)
        left -= val
        solved += val // (100 * (j + 1))
    if left > 0:
        continue
    ans = min(ans, solved)
print(ans)

Submission status: Wrong Answer

Solution code:
# 参考：https://atcoder.jp/contests/abc104/submissions/15357043
import itertools
D, G = map(int, input().split(" "))
SPC = [[100 * (i + 1)] + [int(_) for _ in input().split()] for i in range(D)][::-1]

ans = float("inf")
for i in range(D + 1):
    completes = set(itertools.combinations(range(D), i))
    for complete in completes:
        incomplete = sorted(set(range(D)) - set(complete))
        score = 0
        cnt = 0
        f = 0
        for j in complete:
            s, p, c = SPC[j]
            score += s * p + c
            cnt += p
        for j in incomplete:
            if score >= G:
                break
            s, p, c = SPC[j]
            d = min(p - 1, 1 + (G - score - 1) // s)
            score += s * d
            cnt += d
        if score >= G:
            ans = min(ans, cnt)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(d)]
all_sum = []
for i in range(2**d):
    s = 0
    a = 0
    rest = []
    for j in range(d):
        if i and (2**j):#&:and
            s =s+ pc[j][0]*100*(j+1) + pc[j][1]
            a =a+ pc[j][0]
        else :
            rest.append(i)   
    if s >= g :
        all_sum.append(a)
    else :
        l = max(rest)
        diff = g - s
        for k in range(pc[l][0]):
            if j*(l+1)*100 >= diff:
                all_sum.append(a+k)
print(min(all_sum))

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
v=[list(map(int,input().split())) for i in range(d)]
ans=1000
for i in range(1<<d):
  s=0
  n=0
  for j in range(d):
    if i>>j&1 == 1:
      s += v[j][0] * (j+1) * 100 + v[j][1]
      n += v[j][0]
  for j in range(d-1,-1,-1):
    if i>>j&1 == 0:
      r = ((g-s)//100 + j) // (j+1)
      if r<0 or r>v[j][0]:
        n = 1000
      else:
        n += r
      break
  ans=min(ans,n)
print(ans)

Submission status: Wrong Answer

Solution code:
D, G, *pc = map(int, open(0).read().split())
pc = list(zip(*[iter(pc)]*2))

# 全完一つで達成できるケース

total_points = []
for i in range(D):
    total_points.append(pc[i][0] * (i+1) * 100 + pc[i][1])
    
ans_list = [i[0] for i, x in zip(pc, total_points) if x >= G]

# 難しい問題から順に解いていくケース

import math

achieved = False
remained = G
highest_p = D

ans_other = 0

while not achieved:
    if remained <= 0:
        achieved = True
    elif math.ceil(remained / (highest_p * 100)) <= pc[highest_p - 1][0]:
        ans_other += math.ceil(remained / (highest_p * 100))
        remained -= (math.ceil(remained / (highest_p * 100)) * highest_p * 100)
    else:
        ans_other += pc[highest_p - 1][0]
        remained -= (highest_p * 100 * pc[highest_p - 1][0] + pc[highest_p - 1][1])
        highest_p -= 1
        
ans_list.append(ans_other)

# 完答ボーナスを含め、最も効率の良い問題から解くケース
efficient_order = sorted(list(zip([x/y for x,(y,z) in list(zip(total_points, pc))], range(1, D+1))), reverse = True)

remained = G
ans_other = 0

for _, i in efficient_order:
        if remained <= 0:
            break
        elif math.ceil(remained / (i * 100)) <= pc[i - 1][0]:
            ans_other += math.ceil(remained / (i * 100))
            remained -= (math.ceil(remained / (i * 100)) * i * 100)
        else:
            ans_other += pc[i - 1][0]
            remained -= (i * 100 * pc[i - 1][0] + pc[i - 1][1])

ans_list.append(ans_other)

print(min(ans_list))

Submission status: Wrong Answer

Solution code:
D, G, *pc = map(int, open(0).read().split())
pc = list(zip(*[iter(pc)]*2))
 
# 全完一つで達成できるケース
 
total_points = []
for i in range(D):
    total_points.append(pc[i][0] * (i+1) * 100 + pc[i][1])
    
ans_list = [i[0] for i, x in zip(pc, total_points) if x >= G]
 
# 完答ボーナスを含め、最も効率の良い問題から解くケース
import math

efficient_order = sorted(list(zip([x/y for x,(y,z) in list(zip(total_points, pc))], range(1, D+1))), reverse = True)
 
achieved = False
remained = G
highest_p = D
 
ans_other = 0
 
for _, i in efficient_order:
        if remained <= 0:
            break
        elif math.ceil(remained / (i * 100)) <= pc[i - 1][0]:
            ans_other += math.ceil(remained / (i * 100))
            remained -= (math.ceil(remained / (i * 100)) * i * 100)
        else:
            ans_other += pc[i - 1][0]
            remained -= (i * 100 * pc[i - 1][0] + pc[i - 1][1])

ans_list.append(ans_other)
 
print(min(ans_list))

Submission status: Wrong Answer

Solution code:
D, G, *pc = map(int, open(0).read().split())
pc = list(zip(*[iter(pc)]*2))

total_points = []
for i in range(D):
    total_points.append(pc[i][0] * (i+1) * 100 + pc[i][1])
    
ans_list = [i[0] for i, x in zip(pc, total_points) if x >= G]

import math

achieved = False
remained = G
highest_p = D

ans_other = 0

while not achieved:
    if remained <= 0:
        achieved = True
    elif math.ceil(remained / (highest_p * 100)) <= pc[highest_p - 1][0]:
        ans_other += math.ceil(remained / (highest_p * 100))
        remained -= (math.ceil(remained / (highest_p * 100)) * highest_p * 100)
    else:
        ans_other += pc[highest_p - 1][0]
        remained -= (highest_p * 100 * pc[highest_p - 1][0] + pc[highest_p - 1][1])
        highest_p -= 1
        
ans_list.append(ans_other)

print(min(ans_list))

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import math
# for AtCoder
# import fractions
from collections import deque 
from functools import reduce

# input = sys.stdin.readline
# D：得点ごとの問題 G：目標得点
d, g = map(int, input().split())
p = [list(map(int, input().split())) for x in range(d)]
for i in range(d):
    ex = ((i+1) * 100 * p[i][0] + p[i][1]) / p[i][0]
    p[i].append(ex)
    p[i].append((i+1)*100)
p.sort(key=lambda x : x[3], reverse=True)
cnt = 0
point = 0
total = 0
for i in range(d):
    i_total = p[i][0] * p[i][3] + p[i][1]
    cnt_c = p[i][0]
    # 目標を達成できる
    point_h = 0
    point_h_idx = i
    for j in range(i, d):
        if p[j][3] > point_h:
            point_h = p[j][3]
            point_h_idx = j
    cnt_c2 = ((g - total) + (p[j][3] - 1)) // p[j][3]
    if cnt_c2 > p[j][0]:
        cnt_c2 = p[j][0]
    # ポイントの高い方で超えるか
    if cnt_c2 * p[j][3] + total >= g:
        cnt += cnt_c2
        break
    cnt += p[i][0]
    total += i_total
    if (total >= g):
        break
print(cnt)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
for i, p in enumerate(pc):
    pc[i].append((i+1)*100*p[0]+p[1])
    pc[i].append(((i+1)*100*p[0]+p[1])/p[0])
    pc[i].append((i+1)*100)
pc.sort(key=lambda x :x [3], reverse=True)
po = 0
cnt = 0
mi = 1000000000
for p in pc:
    if p[2] + po < G:
        po += p[2]
        cnt += p[0]
        continue
    if p[0] * p[4] + po >= G:
        if (G-po) % p[4] == 0:
            cn = (G-po) // p[4] 
        else:
            cn = (G-po) // p[4] + 1
#         print(mi, cnt, cn)
        mi = min(mi, cnt+cn)
#         print(mi)
        continue
    if (G-po-p[1]) % p[4] == 0:
        cn = (G-po-p[1]) // p[4] 
    else:
        cn = (G-po-p[1]) // p[4] + 1
#     print(cnt, cn)
#     print(mi, cnt, p[0])
    mi = min(mi, cnt+p[0])
print(mi)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
for i, p in enumerate(pc):
    pc[i].append((i+1)*100*p[0]+p[1])
    pc[i].append(((i+1)*100*p[0]+p[1])/p[0])
    pc[i].append((i+1)*100)
pc.sort(key=lambda x :x [3], reverse=True)
po = 0
cnt = 0
mi = 100
for p in pc:
    if p[2] + po < G:
        po += p[2]
        cnt += p[0]
        continue
    if p[0] * p[4] + po >= G:
        if (G-po) % p[4] == 0:
            cn = (G-po) // p[4] 
        else:
            cn = (G-po) // p[4] + 1
#         print(mi, cnt, cn)
        mi = min(mi, cnt+cn)
#         print(mi)
        continue
    if (G-po-p[1]) % p[4] == 0:
        cn = (G-po-p[1]) // p[4] 
    else:
        cn = (G-po-p[1]) // p[4] + 1
#     print(cnt, cn)
#     print(mi, cnt, p[0])
    mi = min(mi, cnt+p[0])
print(mi)

Submission status: Wrong Answer

Solution code:
import collections

d,g=  map(int, raw_input().split())
cc = {0:0}
picis = [map(int,raw_input().split()) for _ in range(d)]
pisum = sum([pi for pi,ci in picis])
for i in range(len(picis)):
	pi,ci = picis[i]
	for p in range(1, pisum + 1):
		for q in range(1, pi + 1):
			if p - q >= 0 and (p - q) in cc:
				cc[p] = max(cc[p] if p in cc else -float('inf'), cc[p - q] + (100 * q * (i + 1)) +(ci if pi == q else 0))
			else:
				break

for k in range(pisum+1):
	if cc[k] > g:
		print k
		break

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
pc = [0]*d
for i in range(d):
    pc[i] = list(map(int,input().split()))
ans = float("Inf")
for i in range(2**d):
    lis = []
    score = 0
    c = 0
    for j in range(d):
        if (i>>j)&1:
            lis.append(j)
            
    for k,j in enumerate(lis):
        score += (j+1)*100*(pc[j][0]) + pc[j][1]
        c += pc[j][0]
    if score > g:
        pass
    else:
        for j in range(d):
            r = 0
            x = d-1-j
            if x in lis:
                pass
            else:
                r = -(-(g - score)//(100*(x+1)))
                if 0 < r < pc[j][0]:
                    c += r
                else:
                    c = float("Inf")
                break
    #print(c,score,r)
    ans = min(ans, c)
print(ans)

Submission status: Wrong Answer

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

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

score_list = [0] * d

for i in range(d):
    p, c = map(int, list(input().split(' ')))
    score_list[i] = {
        "index": i + 1,
        "number": p,
        'bornus': c,
        'score': 100 * (i + 1),
        'total_score': 100 * (i + 1) * p + c
    }

score_list.sort(key=lambda x: x["total_score"], reverse=True)

ans = 0
for item in score_list:

    if g >= item['total_score']:
        ans += item['number'] 
        g -= item['total_score']
    else:
        _num = g // item['score']
        ans += _num
        break

print(ans)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
g //= 100
lst = []
num = 0
for _ in range(d):
  p, c = map(int, input().split())
  num += p
  lst.append((p, c))
score = [0]*(num + 1)
for i in range(d):
  p = lst[i][0]
  c = lst[i][1]
  c //= 100
  for j in range(p+1):
    for k in range(num+1):
      if k >= j and j < p:
        score[k] = max(score[k], score[k-j] + (i+1)*j)
      elif k >= j and j == p:
        score[k] = max(score[k], score[k-j] + (i+1)*j + c)
for i in range(num+1):
  if score[i] >= g:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
g //= 100
lst = []
num = 0
for _ in range(d):
  p, c = map(int, input().split())
  num += p
  lst.append((p, c))
score = [0]*(num + 1)
for i in range(d):
  p = lst[i][0]
  c = lst[i][1]
  for j in range(p+1):
    for k in range(num+1):
      if k >= j and j < p:
        score[k] = max(score[k], score[k-j] + (i+1)*j)
      elif k >= j and j == p:
        score[k] = max(score[k], score[k-j] + (i+1)*j + c)
for i in range(num+1):
  if score[i] >= g:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
from itertools import product
import math
D,G = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(D)]
cmin = 10**3+5
for x in product((0,1),repeat=D):
    score = 0
    cnt = 0
    for i in range(D):
        if x[i]==1:
            p,c = A[i]
            score += (i+1)*100*p+c
            cnt += p
    if score>=G:
        cmin = min(cmin,cnt)
    else:
        for i in range(D-1,-1,-1):
            if x[i]==0:
                p,c = A[i]
                n = math.ceil((G-score)//((i+1)*100))
                if score+n*(i+1)*100>=G and n<p:
                    cnt += n
                    cmin = min(cmin,cnt)
                break
print(cmin)

Submission status: Wrong Answer

Solution code:
from itertools import product
import math
D,G = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(D)]
cmin = 10**3+5
for x in product((0,1),repeat=D):
    score = 0
    cnt = 0
    for i in range(D):
        if x[i]==1:
            p,c = A[i]
            score += (i+1)*100*p+c
            cnt += p
    if score>=G:
        cmin = min(cmin,cnt)
    else:
        for i in range(D-1,-1,-1):
            if x[i]==0:
                p,c = A[i]
                n = math.ceil((G-score)//((i+1)*100))
                if n<p:
                    cnt += n
                    cmin = min(cmin,cnt)
                break
print(cmin)

Submission status: Wrong Answer

Solution code:
from itertools import product
import math
D,G = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(D)]
cmin = 10**3+5
for x in product((0,1),repeat=D):
    score = 0
    cnt = 0
    for i in range(D):
        if x[i]==1:
            p,c = A[i]
            score += (i+1)*100*p+c
            cnt += p
    if score>=G:
        cmin = min(cmin,cnt)
    else:
        for i in range(D-1,-1,-1):
            if x[i]==0:
                p,c = A[i]
                if score+(i+1)*100*(p-1)>=G:
                    n = math.ceil((G-score)//((i+1)*100))
                    cnt += n
                    cmin = min(cmin,cnt)
                break
print(cmin)

Submission status: Wrong Answer

Solution code:
from itertools import product
import math
D,G = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(D)]
cmin = 10**3+5
for x in product((0,1),repeat=D):
    score = 0
    cnt = 0
    for i in range(D):
        if x[i]==1:
            p,c = A[i]
            score += (i+1)*100*p+c
            cnt += p
    if score>=G:
        cmin = min(cmin,cnt)
    else:
        for i in range(D-1,-1,-1):
            if x[i]==0:
                p,c = A[i]
                if score+(i+1)*100*(p-1)>=G:
                    n = math.ceil((G-score)//((i+1)*100))
                    cnt += n
                    cmin = min(cmin,cnt)
                    break
print(cmin)

Submission status: Wrong Answer

Solution code:
from itertools import product
import math
D,G = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(D)]
cmin = 10**3+5
for x in product((0,1),repeat=D):
    score = 0
    cnt = 0
    for i in range(D):
        if x[i]==1:
            p,c = A[i]
            score += (i+1)*100*p+c
            cnt += p
    if score>=G:
        cmin = min(cmin,cnt)
    else:
        for i in range(D-1,-1,-1):
            if x[i]==0:
                p,c = A[i]
                if score+(i+1)*100*p>G:
                    n = math.ceil((G-score)//((i+1)*100))
                    cnt += n
                    cmin = min(cmin,cnt)
                    break
print(cmin)

Submission status: Wrong Answer

Solution code:
from itertools import product
import math
D,G = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(D)]
cmin = 10**3+5
for x in product((0,1),repeat=D):
    score = 0
    cnt = 0
    for i in range(D):
        if x[i]==1:
            p,c = A[i]
            score += (i+1)*100*p+c
            cnt += p
    if score>=G:
        cmin = min(cmin,cnt)
    else:
        for i in range(D-1,-1,-1):
            if x[i]==0:
                p,c = A[i]
                if score+(i+1)*100*p>=G:
                    n = math.ceil((G-score)//((i+1)*100))
                    cnt += n
                    break
        cmin = min(cmin,cnt)
print(cmin)

Submission status: Wrong Answer

Solution code:
import sys

D, G = [int(n) for n in input().split()]

score_table = []
for i in range(1, D+1):
    p, c = [int(n) for n in input().split()]
    score_table.append([i*100, p, c])

score_table = sorted(score_table, key=lambda x:x[0], reverse=True)

score = 0
count = 0
for s, p, c in score_table:
    for i in range(1, p+1):
        score += s
        count += 1
        if i == p:
            score += c
        if score >= G:
            print(count)
            sys.exit(0)

Submission status: Wrong Answer

Solution code:
# Bit 
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
ans = float('inf')

for bit in range(1<<D):
    cnt = 0
    total = 0
    left = set(range(1, D+1))

    # 全部解く問題を選ぶ
    for i in range(D):
        if (bit>>i) & 1:
            cnt += pc[i][0]
            total += pc[i][0] * 100 * (i+1) + pc[i][1]
            left.discard(i+1)
    
    if total < G:
        use = max(left)
        n = min(pc[use-1][0], -(-(total-G)//use*100))
        cnt += n
        total += n * use * 100
    
    if total >= G:
        ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1001    #全問題数
 
D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)
 
#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える
 
 
for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
    if score>=G :
        point=min(point,solve)
 
#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想
    elif score<G :
        rest=G-score
        for j in range(D) :
            if (~i>>D-j-1) & 1 :
                needproblem=D-j
                sum=needproblem*100*(P[needproblem-1]-1)
                if rest>sum :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
                    rest-=sum
                    solve+=P[needproblem-1]-1
                elif rest<=sum :
                    solve+=rest//(needproblem*100)
                    rest=0
            if rest<=0 and D*100>solve :
                point=min(point,solve)               
 
print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1001    #全問題数

D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
    if score>=G :
        point=min(point,solve)

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想
    elif score<G :
        rest=G-score
        for j in range(D) :
            if (~i>>D-j-1) & 1 :
                needproblem=D-j
                sum=needproblem*100*(P[needproblem-1]-1)
                if rest>sum :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
                    rest-=sum
                    solve+=P[needproblem-1]-1
                elif rest<=sum :
                    resolve=solve+rest//(needproblem*100)
                    point=min(point,resolve)
                    continue
            else :
                continue

print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1001    #全問題数

D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                  #1問も解かなかった問題の中で最も一題あたりの点が高い問題
            needproblem=j+1
    if score>=G and 1001>point:
        point=min(point,solve)

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想

    elif score<G :                
        rest=G-score
        sum=(P[needproblem-1]-1)*needproblem*100
        if rest>sum :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
            continue
        elif rest<=sum :
            resolve=solve+rest//(needproblem*100)
            point=min(point,resolve)

print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1001    #全問題数

D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                  #1問も解かなかった問題の中で最も一題あたりの点が高い問題
            needproblem=j+1
    if score>=G :
        point=min(point,solve)

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想

    elif score<G :                
        rest=G-score
        sum=(P[needproblem-1]-1)*needproblem*100
        if rest>sum :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
            continue
        elif rest<=sum :
            resolve=solve+rest//(needproblem*100)
            point=min(point,resolve)

print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1001    #全問題数

D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                  #1問も解かなかった問題の中で最も一題あたりの点が高い問題
            needproblem=j+1
    if score>=G :
        point=min(point,solve)

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想

    elif score<G :                
        needsolve=(G-score)//(needproblem*100)
        if needsolve>P[needproblem-1] :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
            continue
        elif needsolve<P[needproblem-1] :
            resolve=solve+needsolve+1
            point=min(point,resolve)

print(point)