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:
import itertools

D, G = map(int, input().split())
Q = []
for _ in range(D):
    Q.append(tuple(map(int, input().split())))

ans = 1000  # 制約上の最大値
for t in itertools.product([0, 1], repeat=D):
    score = sum(t[i] * (Q[i][0] * 100 * (i + 1) + Q[i][1]) for i in range(D))
    ans_tmp = sum(t[i] * Q[i][0] for i in range(D))
    if score < G:
        p = D - 1
        while t[p] == 1:
            p -= 1
        addition_q = (G - score) // (100 * (p + 1))
        if addition_q >= Q[p][0]:
            continue
        ans_tmp += addition_q
    ans = min(ans, ans_tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
########10進法からn進法への変換関数部分##############
def format(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
############################

########10進法からn進法への変換関数(m桁埋める)部分##############
def format0(X, n, m):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    if len(out) < m:
        out = "0" * (m - len(out)) + out
    return out
############################
d,g = map(int,input().split())
prob_nums = []
bonuses = []
for i in range(d):
  p,c=map(int,input().split())
  prob_nums.append(p)
  bonuses.append(c)

num_list=[]
#t=[]
for i in range(1<<d):
  i=format0(i,2,d)
  score=0
  num=0
  other=[]
  for j in range(d):
    if i[j] == "1":
      score += prob_nums[j] * 100 * (j+1) + bonuses[j]
      num += prob_nums[j]
    else:
      other.append(j)
  if i == "1"*d:
    num_list.append(num)
    break
  j=max(other)
  if g <= score:
    num_list.append(num)
  elif g <= score + (prob_nums[j]-1) * 100 * (j+1):
    if (g - score) % 100*(j+1)==0:
      num_list.append(num +(g - score) // (100*(j+1)))
      #print("g:",g,"score:",score,"j:",j,"num:",num)
      #print(g-score,100*(j+1))
      #print(num +(g - score) / 100*(j+1))
      #exit()
    else:
      num_list.append(1+num +(g - score) // 100*(j+1))
#print(num_list)
print(min(num_list))

Submission status: Wrong Answer

Solution code:
import itertools

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

ans = 10**5

for v in itertools.product([0,1],repeat=D):
    p = 0
    t = 0
    for i in range(D):
        if v[i] == 1:
            p += (i+1)*100*pc[i][0] + pc[i][1]
            t += pc[i][0]
    w = G-p
    if w > 0:
        for i in range(D):
            if v[i] == 0 and w <= (i+1)*100*(pc[i][0]-1):
                a = (i+1)*100
                tt = t+(w+a-1)//a
                ans = min(ans,tt)
    else:
        ans = min(ans,t)
print(ans)

Submission status: Wrong Answer

Solution code:
"""
bit全探索
"""

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

for i in range(2 ** D):
    a = 0
    b = 0
    for j in range(D):
        if i >> j & 1:
            a += 100 * P[j] * (j + 1) + C[j]
            b += P[j]
    for k in range(D-1, -1, -1):
        if i >> k & 1:
            continue
        if a >= G:
            break
        for l in range(P[k]-1):
            a += 100 * (k + 1)
            b += 1
            if a >= G:
                break
    ans = min(ans, b)
print(ans)

Submission status: Wrong Answer

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


def dfs(i, sum, count, nokori):
    global ans
    if i == D:
        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})


ans = float('inf')

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

Submission status: Wrong Answer

Solution code:
def main():
    D, G, *pc = map(int, open(0).read().split())
    p = pc[::2]
    c = pc[1::2]
    # コンプリート
    comp = [c[i] + 100 * (i + 1) * p[i] for i in range(D)]
    ans = 0
    # 得点が高い方から
    for i in range(D, 0, -1):
        if G // (100 * i) < p[i - 1]:
            ans += G // (100 * i)
            break
        else:
            ans += p[i - 1]
            G -= comp[i - 1]
    print(ans)
    return


main()

Submission status: Wrong Answer

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

problems = [tuple(map(int, input().split())) for _ in range(D)]
ans = 10**10

for mid in range(D):
    for mask in range(1 << D):
        point = 0
        cnt = 0
        for i, (p, c) in enumerate(problems):
            if i == mid:
                continue
            if (mask & (1 << i)) > 0:
                cnt += p
                point += 100 * (i + 1) * p + c

        if point < G:
            p, c = problems[mid]
            k = -(-(G - point) // (100 * (mid + 1)))
            if k > p:
                continue
            cnt += k

        ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

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

problems = [tuple(map(int, input().split())) for _ in range(D)]
ans = 10**10

for mid in range(D):
    for mask in range(1 << D):
        point = 0
        cnt = 0
        for i, (p, c) in enumerate(problems):
            if i == mid:
                continue
            if (mask & (1 << i)) > 0:
                cnt += p
                point += 100 * (i + 1) * p + c

        if point < G:
            p, c = problems[mid]
            k = -(-(G - point) // (100 * (mid + 1)))
            if k > p:
                continue
            cnt += k
            point += 100 * (mid + 1) * k
        if point >= G and ans > cnt:
            ans = cnt

print(ans)

Submission status: Wrong Answer

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

L = []

P = [0] * D

t = 10 ** 9
m = 0

for i in range(1,D + 1):
  p,c = map(int,input().split())
  s = 0
  pc = []
  for j in range(p):
    s += i * 100
    if j == p - 1:
      s += c
      L.append([j + 1,s])
    if s >= G and j + 1 < t:
      t = j + 1
    pc.append([j + 1,s])
  PC.append(pc)

def recur(score,times,i,problems):
  #引いていった後の数が、使わなかった数の最大値を下回った場合
  if score <= max( [L[i][1] for i in range(D) if P[i] == 0] ) and i == D and score > 0:
    ans = 10 ** 9
    for j in range(D):
      #使わなかったリストから
      if P[j] == 0:
        #点数のリスト
        for k in range(len(PC[j])):
          #引いた後のスコアを上回る点数のなかから最小回数を取得
          if score <= PC[j][k][1] and ans >= PC[j][k][0]:
            ans = PC[j][k][0]
    ans += times
    return ans

  #探索が終了し条件を満たさなかった場合
  elif i == D:
    return 10 ** 9
  
  else:
    #使う
    ret1 = recur(score - L[i][1],times + L[i][0],i + 1,P[i] + 1)
    #使わない
    ret2 =recur(score,times,i + 1,P[i] + 0)
    
    return min(ret1,ret2)

print(recur(G,0,0,P))

Submission status: Wrong Answer

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

L = []

P = [0] * D

t = 10 ** 9
m = 0

for i in range(1,D + 1):
  p,c = map(int,input().split())
  s = 0
  pc = []
  for j in range(p):
    s += i * 100
    if j == p - 1:
      s += c
      L.append([j + 1,s])
    if s >= G and j + 1 < t:
      t = j + 1
    pc.append([j + 1,s])
  PC.append(pc)

def recur(score,times,i,problems):
  #引いていった後の数が、使わなかった数の最大値を下回った場合
  if score <= max( [L[i][1] for i in range(D) if P[i] == 0] ) and i == D:
    ans = 10 ** 9
    for j in range(D):
      #使わなかったリストから
      if P[j] == 0:
        #点数のリスト
        for k in range(len(PC[j])):
          #引いた後のスコアを上回る点数のなかから最小回数を取得
          if score <= PC[j][k][1] and ans >= PC[j][k][1]:
            ans = PC[j][k][0]
    ans += times
    return ans

  #探索が終了し条件を満たさなかった場合
  elif i == D:
    return 10 ** 9
  
  else:
    #使う
    ret1 = recur(score - L[i][1],times + L[i][0],i + 1,P[i] + 1)
    #使わない
    ret2 =recur(score,times,i + 1,P[i] + 0)
    
    return min(ret1,ret2)

print(recur(G,0,0,P))

Submission status: Wrong Answer

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

L = []

P = [0] * D

t = 10 ** 9
m = 0

for i in range(1,D + 1):
  p,c = map(int,input().split())
  s = 0
  pc = []
  for j in range(p):
    s += i * 100
    if j == p - 1:
      s += c
      L.append([j + 1,s])
    if s >= G and j + 1 < t:
      t = j + 1
    pc.append([j + 1,s])
  PC.append(pc)

def recur(score,times,i,problems):
  if score <= max( [L[i][1] for i in range(D) if P[i] == 0]) and i == D:
    ans = 10 ** 9
    for j in range(D):
      #使わなかったリストから
      if P[j] == 0:
        #点数のリスト
        for k in range(len(PC[j])):
          #引いた後のスコアを上回る点数のなかから最小値を記録
          if score <= PC[j][k][1] and ans >= PC[j][k][1]:
            ans = PC[j][k][0]
    ans += times
    return ans
  
  elif i == D:
    return 10 ** 9
  
  else:
    #使う
    ret1 = recur(score - L[i][1],times + L[i][0],i + 1,P[i] + 1)
    #使わない
    ret2 =recur(score,times,i + 1,P[i] + 0)
    
    return min(ret1,ret2)

if t == 10 ** 9:
  print(recur(G,0,0,P))
  
else:
  print(t)

Submission status: Wrong Answer

Solution code:
import itertools
import math

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

all = set()
for x in range(0, d):
    all.add(x)

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

ans = 100000000
for n in range(0, d + 1):
    for select in itertools.combinations(pl, n):
        full_sum = 0
        full_count = 0
        full_list = set()

        for fp, fn, fc in select:
            full_sum += (fp + 1) * 100 * fn + fc
            full_count += fn
            full_list.add(fp)
        
        if full_sum > g:
            ans = min(ans, full_count)
            # print("full: %s rest: None score: %d ans: %d" % (str(full_list), full_sum, ans))

        elif len(all - full_list) > 0:
            rest = max(all - full_list)
            rest_n, rest_p, rest_c = pl[rest]

            if g - full_sum <= (rest_n + 1) * 100 * (rest_p - 1):
                ans = min(ans, full_count + math.ceil((g - full_sum) / ((rest_n + 1) * 100)))
                # print("full: %s rest: %d score: %d ans: %d" % (str(full_list), rest_n, full_sum + rest_n * (rest_p - 1), ans))
        

print(ans)

Submission status: Wrong Answer

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

# greedy
ng = 0
sg = 0
for i, p, c in PC[::-1]:
    for j in range(p):
        ng += 1
        sg += i * 100
        if sg >= G:
            break
    else:
        sg += c
        if sg >= G:
            break
        continue
    break

# complete
totals = [(i, 100 * i * p + c) for i, p, c in PC]
totals.sort(key=lambda x: abs(x[1] - G))

nc = 0
sc = 0
for i, t in totals:
    for j in range(PC[i - 1][1]):
        nc += 1
        sc += i * 100
        if sc >= G:
            break
    else:
        sc += PC[i - 1][2]
        if sc >= G:
            break
        continue
    break

print(min(ng, nc))

Submission status: Wrong Answer

Solution code:
import math

D, G = map(int, input().split())
P = []

for i in range(D):
  p, c = map(int, input().split())
  P.append(((i + 1)*100, p, c))

ans = float("inf")
for i in range(2 ** D):

  score = 0
  count = 0
  maxj = -1

  for j in range(D):
    # print(i, j, bin(i), bin(j), i >> j, ((i >> j) & 1))
    if ((i >> j) & 1):
      val, p, c = P[j]
      score += c + (val * p)
      count += p
    else:
      maxj = max(maxj, j)

  if maxj == -1:
    if score >= G:
      ans = min(ans, count)
  else:
    val, p, c = P[maxj]
    if score + val * (p - 1) >= G:
      s = max(0, math.ceil((G-score) // val ))
      ans = min(ans, count + s)

print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
PC = [0] + [list(map(int, input().split())) for _ in range(D)]
def dfs(i, g):
  if i == 0:
    return 1e9
  mc = min(G // (100 * i), PC[i][0])
  s = mc * 100 * i
  if mc == PC[i][0]:
    s += PC[i][1]
  if s < g:
    mc += dfs(i - 1, g - s)
  return min(dfs(i - 1, g), mc)
print(dfs(D, G))

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
Q = []
for i in range(D):
    p, c = map(int, input().split())
    Q.append([p, c,(i+1)*100])
ans = 10**18
for i in range(2**D):
    state = format(i,'0%ib'%(D))
    value = 0
    count = 0
    for s,(p,c,v) in zip(state,Q):
        if s == '1':
            value += p*v + c
            count += p
    if value >= G:
        ans = min(ans,count)
    else:
        for s,(p,c,v) in zip(reversed(state),reversed(Q)):
            if s == '1':
                continue
            if (G-value) > v*(p-1):
                value += v*(p-1)
                count += p-1
            else:
                if (G-value)%v == 0:
                    c = (G-value)//v
                else:
                    c = int((G-value)/2)+1
                value += v*c
                count += c
                ans = min(ans,count)
                break
print(ans)

Submission status: Wrong Answer

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

s = 0
Q = []
for i, (p, c) in enumerate(PC):
    s += p
    Q.append((i+1, p, c))
    
dp = [-10**18]*(s+1)
dp[0] = 0

for i, p, c in Q:
  for j in range(0, s+1): # 解きうる問題総数をイテレート
    for k in range(1, p+1): # 解く問題数をイテレート
      if k == p:
        cc = 100*i*k + c
      else:
        cc = 100*i*k
      if j - k >= 0:
        dp[j] = max(dp[j], dp[j - k] + cc)

for i, total in enumerate(dp):
  if total >= G:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import math, sys
sys.setrecursionlimit(10**6)
d,g = map(int, input().split())
data = []
ans = 100000
for i in range(1,d+1):
    p, c = map(int, input().split())
    data.append([i*100 , p , c])
def dfs(li):
    if len(li) == d:
        if not (True in li):
            return 
        global ans
        total = 0
        candidate = 0
        for i in range(d):
            if li[i]:
                total += data[i][0] * data[i][1] + data[i][2]
                candidate += data[i][1]
        if total >= g:
            ans = min(ans, candidate)
        else:
            max_point = max([data[i] for i in range(d) if not li[i]])
            if max_point[0] * (max_point[1] - 1) + total >= g:
                candidate += math.ceil((g - total) / max_point[0])
                ans = min(ans, candidate)
    else:
        dfs(li + [False])
        dfs(li + [True])
dfs([])
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools


max_d, goal = [int(i) for i in input().split()]
problems = [[int(i) for i in input().split()] for _ in range(max_d)]

ans = float('inf')
for bits in itertools.product((0, 1), repeat=max_d):
    score = 0
    solve = 0
    rest = set(range(max_d))

    for i in range(max_d):
        if bits[i] == 1:
            score += problems[i][0] * (i+1) * 100 + problems[i][1]
            solve += problems[i][0]
            rest.discard(i)
    if score < goal:
        target = max(rest)
        target_solve = min(problems[target][0], -(score-goal) // ((target+1)*100))
        score += target_solve * (target+1) * 100
        solve += target_solve

    if score >= goal:
        ans = min(ans, solve)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools


max_d, goal = [int(i) for i in input().split()]
problems = [[int(i) for i in input().split()] for _ in range(max_d)]

ans = 100 * 10
for bits in itertools.product((0, 1), repeat=max_d):
    score = 0
    solve = 0
    rest = set(range(max_d))

    for i in range(max_d):
        if bits[i] == 1:
            score += problems[i][0] * (i+1) * 100 + problems[i][1]
            solve += problems[i][0]
            rest.discard(i)
    if score < goal:
        target = max(rest)
        target_solve = min(problems[target][0], -(score-goal) // ((target+1)*100))
        score += target_solve * (target+1) * 100
        solve += target_solve

    if score >= goal:
        ans = min(ans, solve)
print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
li = []
 
for i in range(d):
    p,c = map(int,input().split())
    li.append([p,c])
 
ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                    #print(44444444)
                else:
                    cnt2 = min(((memo2//(100*(j+1)))+1),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2
                break
    if ttl >= g:
        ans = min(ans,cnt)
"""   
    if ans == cnt:
        print(memo,ttl,111111)
"""   
    
 
print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
li = []

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

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                    #print(44444444)
                else:
                    cnt2 = min(((memo2//(100*(j+1)))+1),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2
                break
    if ttl >= g:
        ans = min(ans,cnt)
"""   
    if ans == cnt:
        print(memo,ttl,111111)
"""   
    

print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
li = []

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

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                    #print(44444444)
                else:
                    cnt2 = min(memo2//(100*(j+1)+1),10**9)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
    """
    if ans == cnt:
        print(memo,ttl,111111)"""
    
    

print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
li = []

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

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                    #print(44444444)
                else:
                    cnt2 = min(memo2//(100*(j+1)+1),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
    """
    if ans == cnt:
        print(memo,ttl,111111)"""
    
    

print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
li = []

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

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1

    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                else:
                    cnt += memo2//(100*(j+1))+1
                    ttl += (memo2//(100*(j+1))+1)*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
    

    
    

print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
li = []

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

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                    #print(44444444)
                else:
                    cnt2 = min(memo2//(100*(j+1)+1),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
    """
    if ans == cnt:
        #print(memo,ttl,111111)
    """
    
    

print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
li = []

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

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt += memo2//(100*(j+1))
                    ttl += (memo2//(100*(j+1)))*(100*(j+1))
                else:
                    cnt += memo2//(100*(j+1))+1
                    ttl += (memo2//(100*(j+1))+1)*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
    """
    if ans == cnt:
        print(memo,ttl)
    """
    

print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
li = []

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

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt += memo2//(100*(j+1))
                    ttl += (memo2//(100*(j+1)))*(100*(j+1))
                else:
                    cnt += memo2//(100*(j+1))+1
                    ttl += (memo2//(100*(j+1))+1)*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
    
    if ans == cnt:
        print(memo,ttl)
    

print(ans)

Submission status: Wrong Answer

Solution code:
D,G = list(map(int,input().split()))
t = [[0,0]]
for i in range(D):
    t.append(list(map(int,input().split())))
def down(i,j,ans,wa):
    if wa >= G:
        return ans
        exit()
    else:
        if i == 0:
            for k in range(1,D+1):
                down(k,1,ans+1,wa+100*i)
        elif j < t[i][0]-1:
            down(i,j+1,ans+1,wa+100*i)
        elif j == t[i][0]-1:
            down(i,t[i][0],ans+1,wa+100*i+t[i][1])
        elif j == t[i]:
            if 1 < i :
                down(i-1,1,ans+1,wa+100*(i-1))
def up(i,j,ans,wa):
    if wa >= G:
        return ans
        exit()
    else:
        if i == 0:
            for k in range(1,D+1):
                up(k,1,ans+1,wa+100*i)
        elif j < t[i][0]-1:
            up(i,j+1,ans+1,wa+100*i)
        elif j == t[i][0]-1:
            up(i,t[i][0],ans+1,wa+100*i+t[i][1])
        elif j == t[i]:
            if i < D :
                up(i+1,1,ans+1,wa+100*(i+1))

print(up(0,0,0,0))

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
ten=[[] for i in range(D)]
for i in range(D):
    p,c=map(int,input().split())
    ten[i]=[p,c]
ans=float("INF")
for i in range(1<<D):
    cnt=0
    toku=0
    for j in range(D-1,-1,-1):
        flg=False
        if 1 and i>>j:
            for k in range(ten[j][0]):
                toku+=(j+1)*100
                cnt+=1
                if k==ten[j][0]-1:
                    toku+=ten[j][1]
                if toku>=G:
                    flg=True
                    break
            else:
                continue
            break
    if flg:
        ans=min(ans,cnt)
print(ans)

Submission status: Wrong Answer

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

l = [list(map(int,input().split())) for i in range(d)]
ans = float("inf")

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

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
table = []
for i in range(D):
    p,c = map(int, input().split())
    table.append((i+1,p,c))
ans = 10**3
for i in range(1<<D):
    count = 0
    score = 0
    remain = []
    for j in range(D):
        d,p,c = table[j]
        if i & (1<<j):
            score += 100*(d)*p+c
            count += p
        else:
            remain.append((d,p,c))
    if score < G:
        remain.sort(reverse=True)
        d,p,c = remain[0]
        while score < G:
            score += 100*d
            count += 1
    ans = min(ans,count)
print(ans)

Submission status: Wrong Answer

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

import copy

class Problem:
    def __init__(self, i, num, comp):
        self.point = (i + 1) * 100
        self.num = num
        self.comp = comp
        self.total = (i + 1) * 100 * num + comp 
        self.per = self.total / self.num 

nums=list(map(int,input().split()))
D = nums[0]
G = nums[1]
problems= []
for i in range(D):
    nums=list(map(int,input().split()))
    problems.append(Problem(i, nums[0], nums[1]))


min_num = 1000

for i in range(D):
    level = copy.deepcopy(problems)
    tmp_comp = sorted(problems, key=lambda u: u.per)
    sm = 0
    sm_num = 0
    res = []
    for _ in range(i):
        tmp_comp.pop()

    while len(tmp_comp) != 0 and G - sm > 0:
        tmp_problem = tmp_comp.pop()

        if G - sm < level[-1].point * level[-1].num and tmp_problem.per <= level[-1].point:
            cnt = level[-1].num
            while G - sm > 0 and cnt > 0:
                sm += level[-1].point
                sm_num += 1
                cnt -= 1
            if min_num > sm_num:
                min_num = sm_num
                break
        elif tmp_problem.per > level[-1].point:
            sm += tmp_problem.total
            sm_num += tmp_problem.num
            level = sorted(tmp_comp, key=lambda u: u.point)
            
            
            
        else:
            res.append(tmp_problem)
    

    
    res.sort(key=lambda u: u.point)

    while sm < G and len(res) != 0:
        tmp_problem = res.pop()
        for i in range(tmp_problem.num):
            sm += tmp_problem.point
            sm_num += 1
            if sm >= G:
                break
            
            
    if min_num > sm_num and G <= sm:
        min_num = sm_num
    

print(min_num)