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

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

A = []
B = {i for i in range(D)}
for i in range(D+1):
    A += list(combinations(B, i))

print(A)

ans = []
for ai in A:
    p = 0  # ポイント
    c = 0  # 問題数
    for aii in ai:
        p += PC[aii][2]
        c += PC[aii][0]
    if p < G:
        x = B.difference(ai)
        max_x = max(x)
        cnt = 0
        while p < G and cnt < PC[max_x][0]:
            p += (max_x + 1) * 100
            cnt += 1
            c += 1
        if p >= G:
            # ans.append([p, c])
            ans.append(c)
    else:
        # ans.append([p, c])
        ans.append(c)

print(min(ans))

Submission status: Wrong Answer

Solution code:
import sys
from math import ceil
inputs = sys.stdin.readlines()

d, g = map(int, inputs[0].split())
P = list(map(int, map(lambda x: x.split()[0], inputs[1:])))
C = list(map(int, map(lambda x: x.split()[1], inputs[1:])))

ans = float('inf')
for bit in range(1 << d):
    count, total, rest = 0, 0, set(range(1, d+1))
    for i in range(d):
        if bit & (1 << i):
            total += P[i] * (i + 1) * 100 + C[i]
            count += P[i]
            rest.discard(i + 1)

    if total < g:
        use = max(rest)
#         n = min(P[use-1], ceil((g - total) / (use * 100)))
#         count += n
#         total += n * use * 100
        n = ceil((g - total) / (use * 100))
        if P[use-1] > n:
            count += n
            total += n * use * 100
            ans = min(ans, count)
#     if total >= g:
#         ans = min(ans, count)
print(ans)

Submission status: Wrong Answer

Solution code:
import math
D, G = list(map(int, input().split()))
p = [list(map(int, input().split())) for _ in range(D)]

ans = float("inf")
for i in range(1<<D):
    count = 0
    num = 0
    rest_num = set(range(1, D+1))
    for j in range(D):
        if (i>>j)&1:
            num += p[j][1]+(i+1)*100*p[j][0]
            count += p[j][0]
            rest_num.discard(i+1)
    if num < G:
        max_num = max(rest_num)
        n = min(p[max_num-1][0], math.ceil((G-num)/(max_num*100)))
        count += n
        num += n*max_num*100
    if num >= G:
        ans = min(ans, count)
    
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p_and_c = [list(map(int, input().split())) for _ in range(d)]
min_number = 1000
for i in range(2**d):
    score = 0
    number = 0
    p_and_c_copy = p_and_c.copy()
    rest_num = set(range(1, d+1))
    for j in range(d):
        if i & (1 << j):
            number += p_and_c_copy[j-d][0]
            score += p_and_c_copy[j-d][1] + 100 * (j+1) * p_and_c_copy.pop(j-d)[0]
            rest_num.discard(j+1)
    print(score)
    if p_and_c_copy:
        for k in range(p_and_c_copy[-1][0]):
            if score >= g:
                break
            score += 100 * max(rest_num)
            number += 1
        else:
            continue
    min_number = min(min_number, number)
print(min_number)

Submission status: Wrong Answer

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

ret = float('inf')
for i in range(2 ** D) :
    g = G
    last = 0
    count = 0
    for j in range(D) :
        if i % 2 == 0 :
            last = j
        else :
            g -= pc[j][0] * (j + 1) * 100 + pc[j][1]
            count += pc[j][0]
        i //= 2
    
    if pc[last][0] * (last + 1) * 100 <= g :
        continue
        
    if g <= 0 :
        ret = min(ret, count)
    else :
        count += g // ((last + 1) * 100)
        ret = min(ret, count)
        
print(ret)

Submission status: Wrong Answer

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

ans = float('inf')
for bit in range(1 << D):
    count = 0
    num = 0
    rest_num = set(range(1, D+1))

    for i in range(D):
        if bit & (1 << i):
            num += P[i] * (i+1) * 100 + C[i]
            count += P[i]
            rest_num.discard(i+1)

    if num < G:
        max_num = max(rest_num)
        n = min(P[max_num-1], round((G-num)/(max_num*100)))
        count += n
        num += n * max_num * 100

    if num >= G:
        ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
probs = []
ans = float('inf')
for i in range(d):
    p,c =map(int,input().split())
    probs.append(((i+1)*100,p,c))

for i in range(2**d):
    count = 0
    score = 0
    yet = []
    for j in range(d):
        if ((i >>j) & 1):
            count +=probs[j][1]
            score +=probs[j][2] +probs[j][0]*probs[j][1]
        else:
            yet.append((probs[j][0],probs[j][1]-1))
    if ans <= count:
        continue
    elif score>=g:
        ans = count
        continue
    yet.sort(reverse=True)
    if score+sum([x*y for x,y in yet]) <g:
        continue
    for point,num in yet:
        solve = min((g - score-0.1)//point +1,num)
        count += solve
        score += solve*point
        if count >= ans:
            break
        if score >=g:
            ans = count
print(int(ans))

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
probs = []
ans = float('inf')
for i in range(d):
    p,c =map(int,input().split())
    probs.append(((i+1)*100,p,c))

for i in range(2**d):
    count = 0
    score = 0
    yet = []
    for j in range(d):
        if ((i >>j) & 1):
            count +=probs[j][1]
            score +=probs[j][2] +probs[j][0]*probs[j][1]
        else:
            yet.append((probs[j][0],probs[j][1]-1))
    if ans <= count:
        continue
    elif score>=g:
        ans = count
        continue
    yet.sort(reverse=True)
    if score+sum([x*y for x,y in yet]) <g:
        continue
    for point,num in yet:
        solve = min((g - score-0.1)//point +1,num)
        count += solve
        score += solve*point
        if count >= ans:
            break
        if score >=g:
            ans = count
print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin

D, G = [int(x) for x in stdin.readline().rstrip().split()]
P = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(D)]

dp = [[0] * (sum([x[0] for x in P]) + 1) for _ in range(D + 1)]

for i in range(1, D + 1):
    for j in range(1, len(dp[i])):
        if j <= P[i - 1][0]:
            dp[i][j] = dp[i][j - 1] + 100 * i
        if j - P[i - 1][0] >= 0:
            dp[i][j] = max(dp[i][j], dp[i - 1][j - P[i - 1][0]] + i * P[i - 1][0] * 100 + P[i - 1][1])

ans = 10 ** 8

for i in range(len(dp)):
    for j in range(len(dp[i])):
        if dp[i][j] >= G:
            ans = min(ans, j)

print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin

D, G = [int(x) for x in stdin.readline().rstrip().split()]
P = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(D)]

dp = [[0] * (sum([x[0] for x in P]) + 1) for _ in range(D + 1)]
print(dp)

for i in range(1, D + 1):
    for j in range(1, len(dp[i])):
        if j <= P[i - 1][0]:
            dp[i][j] = dp[i][j - 1] + 100 * i
        if j - P[i - 1][0] >= 0:
            dp[i][j] = max(dp[i][j], dp[i - 1][j - P[i - 1][0]] + i * P[i - 1][0] * 100 + P[i - 1][1])

print(dp)

ans = 10 ** 8

for i in range(len(dp)):
    for j in range(len(dp[i])):
        if dp[i][j] >= G:
            ans = min(ans, j)

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

sys_input = sys.stdin.readline

D, G = map(int, sys_input().split())
pc_list = [tuple(map(int, sys_input().split())) for _ in range(D)]

n_solved = 10000000000
for i in range(1 << D):
    score_per_combi = 0
    combi = []
    tmp_n_solved = 0

    for j in range(D):
        if (i >> j) & 1:
            p = pc_list[j][0]
            c = pc_list[j][1]
            score_per_combi += (j + 1) * 100 * p + c
            combi.append(j)
            tmp_n_solved += p

    if tmp_n_solved == 0:
        continue
    if score_per_combi < G:
        continue

    # problems are already sorted
    # -> check if these were oversolved
    for problem_idx in combi:
        for solved_num in range(pc_list[problem_idx][0]):
            diff = None
            if solved_num == 1:
                c = pc_list[problem_idx][1]
                diff = (problem_idx + 1) * 100 + c
                score_per_combi -= diff
            else:
                diff = (problem_idx + 1) * 100
                score_per_combi -= diff
            tmp_n_solved -= 1

            if score_per_combi < G:
                tmp_n_solved += 1
                score_per_combi += diff
                break
            # Not finish innner loop -> continue outer loop
            else:
                continue
            # Finish innner loop -> break outer loop
            break

    # Check if mininum n_solved are updated
    if tmp_n_solved < n_solved:
        n_solved = tmp_n_solved

print(n_solved)

Submission status: Wrong Answer

Solution code:
import sys

sys_input = sys.stdin.readline

D, G = map(int, sys_input().split())
pc_list = [tuple(map(int, sys_input().split())) for _ in range(D)]

# WIP
temp_min_score = 10000000000000000
combi_min = []
n_solved = 10000000000
for i in range(1 << D):
    score_per_combi = 0
    combi = []
    tmp_n_solved = 0
    
    for j in range(D):
        if (i >> j) & 1:
            p = pc_list[j][0]
            c = pc_list[j][1]
            score_per_combi += (j + 1) * 100 * p + c
            combi.append(j)
            tmp_n_solved += p
    if tmp_n_solved == 0:
        continue
    if score_per_combi >= G and tmp_n_solved < n_solved:
        temp_min_score = score_per_combi
        combi_min = combi
        n_solved = tmp_n_solved

# problems are already sorted
# -> check the problems were oversolved
tmp_reduced = temp_min_score
for problem_idx in combi_min:
    for solved_num in range(pc_list[problem_idx][0]):
        if solved_num == 1:
            c = pc_list[problem_idx][1]
            diff = (problem_idx + 1) * 100 + c
            tmp_reduced -= diff
        else:
            diff = (problem_idx + 1) * 100
            tmp_reduced -= diff
        n_solved -= 1
        
        if tmp_reduced < G:
            print(n_solved + 1)
            exit()

print(n_solved)

Submission status: Wrong Answer

Solution code:
def main():
    from math import ceil
    D, G = (int(i) for i in input().split())
    pc = [[int(i) for i in input().split()] for j in range(D)]
    ans = float('inf')
    for bit in range(1<<D):
        completed = []
        tmp = 0
        cur = 0
        for i in range(D):
            if bit & (1<<i):
                completed.append(i)
        for c in completed:
            tmp += (100*(c+1)*pc[c][0] + pc[c][1])
            cur += pc[c][0]
        for d in range(D)[::-1]:
            if d in completed:
                continue
            less = ceil((max(G - tmp,0))/(100 * (d+1)))
            if pc[d][0] < less:
                continue
            cur += less
            ans = min(ans,cur)
            break
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    from math import ceil
    D, G = (int(i) for i in input().split())
    pc = [[int(i) for i in input().split()] for j in range(D)]
    ans = 10**12
    for bit in range(1<<D):
        completed = []
        tmp = 0
        cur = 0
        for i in range(D):
            if bit & (1<<i):
                completed.append(i)
        for c in completed:
            tmp += (100*(c+1)*pc[c][0] + pc[c][1])
            cur += pc[c][0]
        for d in range(D)[::-1]:
            if d in completed:
                continue
            less = ceil((max(G - tmp,0))/(100 * (d+1)))
            if pc[d][0] < less:
                continue
            cur += less
            ans = min(ans,cur)
            break
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import math
D, G = list(map(int,input().split()))
P = [0]*D
C = [0]*D
for i in range(D):
    p,c = list(map(int,input().split()))
    P[i], C[i] = p, c

ans = float("inf")
for i in range(2**D):
    comp_list = [0]*D
    tmp_num = 0
    tmp_score = 0
    for j in range(D):
        if (i >> j) & 1:
            comp_list[j] = 1
            tmp_num += P[j]
            tmp_score += P[j]*(j+1)*100 + C[j]
    if tmp_score >= G:
        if tmp_num < ans:
            ans = tmp_num
    else:
        list_notcomp= [k for k in range(D) if comp_list[k] == 0]
        if len(list_notcomp) != 0:
            if math.ceil((G - tmp_score) // (100*(max(list_notcomp) + 1))) < P[max(list_notcomp)]:
                tmp_num += math.ceil((G - tmp_score) // (100*(max(list_notcomp) + 1)))
                if tmp_num < ans:
                    ans = tmp_num
print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
ary = [list(map(int,input().split())) for _ in range(d)]
s = set(i for i in range(d))
ans = float("Inf")
for i in range(2**d):
    a = []
    total,count = 0,0
    for j in range(d):
        if i >> j & 1:
            a.append(j)
    for x in a:
        total += 100*(x+1)*ary[x][0]+ary[x][1]
        count += ary[x][0]
    for y in sorted(s - set(a),reverse=True):
        if total + 100*(y+1)*(ary[y][0]-1) >= g:
            count += -(-(g-total) // (100*(y+1)))
            ans = min(ans,count)
            break
        total += 100*(y+1)*(ary[y][0]-1)
        count += ary[y][0]-1
    if total >= g:
        ans = min(ans,count)
print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
ary = [list(map(int,input().split())) for _ in range(d)]
s = set(i for i in range(d))
ans = float("Inf")
for i in range(2**d):
    a = []
    total = 0
    count = 0
    for j in range(d):
        if i >> j & 1:
            a.append(j)

    for x in a:
        total += 100*(x+1)*ary[x][0]+ary[x][1]
        count += ary[x][0]
    if total >= g:
        ans = min(ans,count)
        continue
    for y in sorted(s - set(a),reverse=True):
        if total + 100*(y+1)*(ary[y][0]-1) >= g:
            count += -(-(g-total)) // (100*(y+1))
            ans = min(ans,count)
            break
        total += 100*(y+1)*(ary[y][0]-1)
        count += ary[y][0]-1
    if total >= g:
        ans = min(ans,count)
print(ans)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
li=[list(map(int,input().split())) for i in range(D)]
min_n=float('inf')
for i in range(2**D):
    s=0
    n=0
    for b in range(D):
        if (i >> b) & 0b1 == 1:
            s += li[b][0] * (b+1) * 100 + li[b][1]
            n += li[b][0]
    if s < G:
        for b in range(D):
            if ~(i >> (D-b-1)) & 0b1 == 1:
                if (D-b)*100 * li[D-b-1][0] < G-s:
                    n = float('inf')
                    break
                else:
                    n += (-(-(G-s)) // ((D-b)*100))
                    break
    min_n = min(min_n,n)
print(min_n)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
dic = [0]*(D+1)
for i in range(D):
  p, c = map(int, input().split())
  dic[i+1] = (p,c)
ans = 10**9
for i in range(1,2**D):
  ls = []
  x = i
  v = 0
  count = 0
  for j in range(D):
    if x%2==1:
      ls += [j+1]
    x = x>>1
  for h in ls:
    p, c = dic[h]
    v += p*h*100 + c
    count += p
  if G>v:
    M = max(ls)
    for j in range(1,D+1):
      if j>M:
        break
    else:
      continue
    m = dic[j][0]
    while m>1:
      v += j*100
      count += 1
      m -= 1
      if v>=G:
        break
    else:
      continue
  if count<ans:
    ans = count
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
dic = [0]*(D+1)
for i in range(D):
  p, c = map(int, input().split())
  dic[i+1] = (p,c)
ans = 10**9
for i in range(1,2**D):
  ls = []
  x = i
  v = 0
  count = 0
  for j in range(D):
    if x%2==1:
      ls += [j+1]
    x = x>>1
  for h in ls:
    p, c = dic[h]
    v += p*h*100 + c
    count += p
  if G>v:
    a = ls[0]
    if a==1:
      continue
    a = a-1
    m =dic[a][0]
    while m>1:
      v += a*100
      count += 1
      m -= 1
      if v>=G:
        break
    else:
      continue
  if count<ans:
    ans = count
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
dic = [0]*(D+1)
for i in range(D):
  p, c = map(int, input().split())
  dic[i+1] = (p,c)
ans = 10**9
for i in range(1,2**D):
  ls = []
  x = i
  v = 0
  count = 0
  for j in range(D):
    if x%2==1:
      ls += [j+1]
    x = x>>1
  for h in ls:
    p, c = dic[h]
    v += p*h*100 + c
    count += p
  if G>v:
    a = ls[0]
    if a==1:
      continue
    a = a-1
    m =dic[a][0]
    while m:
      v += a*100
      count += 1
      m -= 1
      if m==0:
        v += dic[a][1]
      if v>=G:
        break
    else:
      continue
  if count<ans:
    ans = count
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
dic = [0]*(D+1)
for i in range(D):
  p, c = map(int, input().split())
  dic[i+1] = (p,c)
ans = 10**9
for i in range(1,2**D):
  ls = []
  x = i
  v = 0
  count = 0
  for j in range(D):
    if x%2==1:
      ls += [j+1]
    x = x>>1
  for h in ls:
    p, c = dic[h]
    v += p*h*100 + c
    count += p
  if G>v:
    a = ls[0]
    if a==1:
      continue
    a = a-1
    m =dic[a][0]
    while m:
      v += a*100
      count += 1
      m -= 1
      if v>=G:
        break
    if G>v:
      continue
  if count<ans:
    ans = count
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
dic = [0]*(D+1)
for i in range(D):
  p, c = map(int, input().split())
  dic[i+1] = (p,c)
ans = 10**9
for i in range(1,2**D):
  ls = []
  x = i
  v = 0
  count = 0
  for j in range(D):
    if x%2==1:
      ls += [j+1]
    x = x>>1
  for h in ls:
    p, c = dic[h]
    v += p*h*100 + c
    count += p
  if G>v:
    a = ls[0]
    if a==1:
      continue
    a = a-1
    m =dic[a][0]
    while m:
      v += a*100
      count += 1
      m -= 1
      if v>=G:
        break
    else:
      continue
  if count<ans:
    ans = count
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
def solve():
  d,g = (int(i) for i in input().split())
  query = []
  ans = 10**15
  for i in range(d):
    p,c = (int(i) for i in input().split())
    query.append((p,c,(i+1)*100))
  for i in range(2**d):
    ct = 0
    point = 0
    use = [False]*d
    for j in range(d):
      if (i>>j)&1 == 1:
        use[j] = True

    for m in range(d):
      if use[m]:
        tp,tc,ti = query[m]
        ct += tp
        point += ti*tp+tc
      
    if point >= g:
      ans = min(ans,ct)
    else:
        for l in range(d):
          if use[d-l-1]:
            continue
          else:
            tp,tc,ti = query[d-l-1]
            twant = math.ceil((g-point)/ti)
            if tp >= twant:
              point += twant*ti
              ct += twant

            if point >= g:
              ans = min(ans,ct)
            
            

  print(ans)
    
    
solve()

Submission status: Wrong Answer

Solution code:
import math

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

answer = 0

for i in range(d):
    now_solve_point = (d - i) * 100
    now_number_of_problem = pc[i][0]
    now_point = now_number_of_problem * now_solve_point
    now_max_point = now_point + pc[i][1]

    pre_number_of_problem = 0
    pre_max_point = 0
    if i != d - 1:
        pre_number_of_problem = pc[i + 1][0]
        pre_max_point = pre_number_of_problem * (d - i - 1) * 100 + pc[i + 1][1]

    if g <= now_point:
        now_count = math.ceil(g / now_solve_point)
        if g <= pre_max_point and pre_number_of_problem < now_count:
            answer += pre_number_of_problem
        else:
            answer += now_count
        break
    elif now_point < g <= now_max_point:
        if g <= pre_max_point and pre_number_of_problem < now_number_of_problem:
            answer += pre_number_of_problem
        else:
            answer += now_number_of_problem
        break
    elif g <= pre_max_point:
        answer += pre_number_of_problem
        break
    elif g <= pre_max_point + now_point:
        answer += pre_number_of_problem + math.ceil((g - pre_max_point) / now_solve_point)
        break
    else:
        g = g - now_max_point
        answer += now_number_of_problem

print(answer)

Submission status: Wrong Answer

Solution code:
import math

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

answer = 0

for i in range(d):
    now_solve_point = (d - i) * 100
    now_number_of_problem = pc[i][0]
    now_point = now_number_of_problem * now_solve_point
    now_max_point = now_point + pc[i][1]

    pre_number_of_problem = 0
    pre_max_point = 0
    if i != d - 1:
        pre_number_of_problem = pc[i + 1][0]
        pre_max_point = pre_number_of_problem * (d - i - 1) * 100 + pc[i + 1][1]

    if g <= now_point:
        now_count = math.ceil(g / now_solve_point)
        if g <= pre_max_point and pre_number_of_problem < now_count:
            answer += pre_number_of_problem
        else:
            answer += now_count
        break
    elif now_point < g <= now_max_point:
        if g <= pre_max_point and pre_number_of_problem < now_number_of_problem:
            answer += pre_number_of_problem
        else:
            answer += now_number_of_problem
        break
    else:
        g = g - now_max_point
        answer += now_number_of_problem

print(answer)

Submission status: Wrong Answer

Solution code:
import sys


#input
lines = [x.strip() for x in sys.stdin.readlines()]
d,g = [int(y) for y in lines.pop(0).split()]
prob = [[int(x.split()[0]),int(x.split()[1])] for x in lines]

isprint = True

def slv(lines):
    smax=0
    ans=0
    bf=[[0 for x in prob],]
    while True:
        l=bf.pop()
        for q in range(len(prob)):
            if l[q]==prob[q][0]:
                break
            ll=[x for x in l]
            ll[q]+=1
            if scr(ll)>=g:
                return sum(ll)
            bf.append(ll)
            #print(bf)
    return ans

                
def scr(ac):
    sm=0
    for n in range(len(prob)):
        sm+=ac[n]*(n+1)*100
        if ac[n] == prob[n][0]:
            sm+=prob[n][1]
    return sm

if __name__ == "__main__":
    print(slv(lines))

Submission status: Wrong Answer

Solution code:
d,g=[int(_) for _ in input().split()]
pclist=[list(map(int,input().split())) for _ in range(d)]
pclist.reverse()
pclist.insert(0,0)
cnt=[]
for i in range(1,d+1):
	sm=c=0
	for k in range(i,d+1):
		if sm>=g:break
		for j in range(pclist[k][0]):
				sm += (d+1-k)*100
				c += 1
				if j==pclist[k][0]-1:
					sm += pclist[k][1]
				if sm>=g:
					cnt.append(c)
					break	
print(min(cnt))

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    D, G = map(int, input().split())
    problems = [[None] * 2 for _ in range(D)]
    ans = float('inf')

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

    for bit in range(1 << D):
        score = 0
        solved = 0
        unsolved = set(range(D))
        for j in range(D):
            if bit & (1 << j):
                score += problems[j][0] * (j+1) * 100 + problems[j][1]
                solved += problems[j][0]
                unsolved.discard(j)

        if score < G:
            use = max(unsolved)
            n = min(problems[use][0]-1, abs(G - score) // ((use + 1) * 100))
            score += n * (use + 1) * 100
            solved += n

        if score >= G:
            ans = min(ans, solved)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    D, G = map(int, input().split())
    problems = [[None] * 2 for _ in range(D)]
    ans = float('inf')

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

    for bit in range(1 << D):
        score = 0
        solved = 0
        unsolved = set(range(D))
        for j in range(D):
            if bit & (1 << j):
                score += problems[j][0] * (j+1) * 100 + problems[j][1]
                solved += problems[j][0]
                unsolved.discard(j)

        if score < G:
            use = max(unsolved)
            n = min(problems[use][0]-1, (G - score) // ((use + 1) * 100))
            score += n * (use + 1) * 100
            solved += n

        if score >= G:
            ans = min(ans, solved)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans=float("inf")

for bit in range(1 << D):
    count = 0
    sum = 0
    nokori = set(range(1,D+1))

    for i in range(D):
        if bit & (1 << i):
            sum=sum+pc[i][0]*(i+1)*100+pc[i][1]
            count=count+pc[i][0]
            nokori.discard(i+1)
    
    #G点に満たなければnokoriのうち一番大きいものをとく
    if sum<G:
        use=max(nokori)
        n=min(pc[use-1][0], -(-(G-sum)//(use*100)))
        count=count+n
        sum=sum+n*(use*100)
    
    else:
        ans=min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(D)]
visited = [0] * D
def dfs(s, c):
  temp = 10 ** 3
  for i in range(D):
    if visited[i] == 0:
      visited[i] = 1
      if s >= p[i][0] * (i + 1) * 100 + p[i][1]:
        temp = min(temp, dfs(s - p[i][0] * (i + 1) * 100 - p[i][1], c + p[i][0]))
      else:
        temp = min(temp, -(-max(s, 0) // ((i + 1) * 100)) + c)
      visited[i] = 0
  #print(s, c, temp)
  return temp
print(dfs(G, 0))

Submission status: Wrong Answer

Solution code:
def solve(D, G):
    p, c = [], []

    for _ in range(D):
        _p, _c = map(int, input().split())
        p.append(_p)
        c.append(_c)

    each_total = []
    ans = float('inf')
    total_ope, total_score = 0, 0

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

    for j in range(1 << D):
        for k in range(D):
            if j >> k & 1:
                total_score += each_total[k]
                total_ope += p[k]
            else:
                solve_half = k

        for _ in range(p[solve_half]-1):
            if total_score >= G:
                break
            else:
                total_score += 100*(solve_half+1)
                total_ope += 1
        if total_score <G:
            continue

        ans = min(ans, total_ope)
        total_ope, total_score = 0, 0

    return ans


if __name__ == '__main__':
    D, G = map(int, input().split())
    print(solve(D, G))

Submission status: Wrong Answer

Solution code:
from itertools import combinations

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=100*10

for i in range(0,D+1):
	for v in combinations(range(D), i):
		t=0
		s=0
		for j in v:
			t+=p[j]
			s+=p[j]*(j+1)*100 + c[j]
		
		if s<G:
			for j in range(D)[::-1]:
				if j in v:
					pass
				else:
					k=(G-s)//((j+1)*100)
					t+=min(p[j]-1,k)
					s+=min(p[j]-1,k)*(j+1)*100
					
					if s>=G:break
		
		ans=min(ans,t)
		
print(ans)