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:
def func():
    D, G = map(int, input().split())
    p = [0] * D 
    bonus = [0] * D
    for i in range(D):
        p[i], bonus[i] = map(int, input().split())
    
    ans = 10000
    for i in range(2 ** D):
        chosen = []
        for j in range(D):
            if ((i >> j) & 1) == 1:
                chosen.append(j)
        
        pointSum = 0
        Nsolved = 0
        for idx in chosen:
            pointSum += (idx + 1) * 100 * p[idx] + bonus[idx]
            Nsolved += p[idx]
        
        if pointSum >= G:
            ans = min(ans, Nsolved)
        else:
            notChosen = list(filter(lambda x: x not in chosen, list(range(D))))
            highestDimIdx = notChosen[-1]
            if pointSum + (highestDimIdx + 1) * 100 * (p[highestDimIdx]-1) >= G:
                rest = G - pointSum
                Nsolved += -(-(rest // ((highestDimIdx + 1) * 100)))
                ans = min(ans, Nsolved)

    print(ans)
        
if __name__ == '__main__':
    func()

Submission status: Wrong Answer

Solution code:
def func():
    D, G = map(int, input().split())
    p = [0] * D 
    bonus = [0] * D
    for i in range(D):
        p[i], bonus[i] = map(int, input().split())
    
    ans = 10000
    for i in range(2 ** D):
        chosen = []
        for j in range(D):
            if ((i >> j) & 1) == 1:
                chosen.append(j)
        
        pointSum = 0
        Nsolved = 0
        for idx in chosen:
            pointSum += (idx + 1) * 100 * p[idx] + bonus[idx]
            Nsolved += p[idx]
        
        if pointSum >= G:
            ans = min(ans, Nsolved)
        else:
            notChosen = list(filter(lambda x: x not in chosen, list(range(D))))
            highestDimIdx = notChosen[-1]
            if pointSum + (highestDimIdx + 1) * 100 * p[highestDimIdx] >= G:
                rest = G - pointSum
                Nsolved += -(-(rest // ((highestDimIdx + 1) * 100)))
                ans = min(ans, Nsolved)

    print(ans)
        
if __name__ == '__main__':
    func()

Submission status: Wrong Answer

Solution code:
from itertools import product
import math

d, g = map(int, input().split())
ps = []
cs = []

for i in range(d):
    pi, ci = map(int, input().split())
    ps.append(pi)
    cs.append(ci)

min_count = 10000000
for pro in product([0,1,2], repeat=d):
    if len([_ for _ in pro if _ == 2]) <= 1:
        tmp_count = 0
        tmp_total = 0
        for i in range(len(pro)):
            if pro[i] == 1:
                tmp_count += ps[i]
                tmp_total += ps[i] * (i+1) * 100 + cs[i]
        if tmp_total >= g:
            min_count = min(min_count, tmp_count)
            continue
        elif 2 in pro and ps[pro.index(2)] * (pro.index(2)+1) * 100 >= g-tmp_total:
            tmp_count += math.ceil((g-tmp_total) // ((pro.index(2)+1) * 100))
            tmp_total += tmp_count * (pro.index(2)+1) * 100
            min_count = min(min_count, tmp_count)
            continue

print(min_count)

Submission status: Wrong Answer

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

ps = []
for i in range(1, d+1):
    i_dict = {}
    pi, ci = map(int, input().split())
    i_dict['p'] = pi
    i_dict['c'] = ci
    ps.append(pi)
    total_dict[i] = i_dict

def calc_sum(p):
    avgs = []
    tmp_sum = 0
    count = 0
    for i in range(1, d + 1):
        if total_dict[i]['p'] <= p:
            avg = (100 * i * total_dict[i]['p'] + total_dict[i]['c']) / total_dict[i]['p']
        else:
            avg = 100 * i
        avgs.append(avg)

    while True:
        argmax = avgs.index(max(avgs))+1
        if tmp_sum >= g:
            return count
        for j in range(total_dict[argmax]['p']):
            if tmp_sum >= g:
                return count
            tmp_sum += 100 * argmax
            count += 1
        tmp_sum += total_dict[argmax]['c']
        avgs[argmax-1] = 0

mins = []
for i in range(1, d+1):
    mins.append(calc_sum(ps[i-1]))

print(min(mins))

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)
    gained_score = 0
    ans = 0
    # minimum cost when choose only one problem set
    v = 10**10
    for i in range(d):
        u = 100*(i+1)*(p[i]-1)+c[i]
        if u >= g:
            v = min(v, p[i])

    # maximum cost is d * pi
    for _ in range(1001):
        if gained_score >= g:
            return ans
        if ans >= v:
            return v
        # problem number Takahashi should take
        x = -1
        # problem score Takahashi should take
        x_score = 0
        for i in range(d):
            if p[i] == 0:
                s = 0
            else:
                s = 100*(i+1)+c[i] if p[i] == 1 else 100*(i+1)
            if x_score < s:
                x = i
                x_score = s
        gained_score += x_score
        p[x] -= 1
        ans += 1


if __name__ == '__main__':
    d, g = map(int, input().split())

    print(solve(d, g))

Submission status: Wrong Answer

Solution code:
def func():
    D, G = map(int, input().split())
    dicts = []
    for i in range(1, D+1):
        n, bonus = map(int, input().split())
        point = i * 100
        cp = (point * n + bonus) / n
        dict = {"point": point, "n": n, "bonus": bonus, "cp": cp}
        dicts.append(dict)

    dicts.sort(key=lambda x: x["cp"], reverse=True)

    sum = 0
    count = 0
    while sum < G:
        dict = dicts.pop(0)
        totalPoints = dict["point"] * dict["n"] + dict["bonus"]
        if totalPoints + sum < G:
            sum += totalPoints
            count += dict["n"]
        elif len(dicts) == 0:
            restPoint = G - sum
            count += min(-(-restPoint // dict["point"]), dict["n"])
            break

        else:
            mxPointDict = sorted(
                dicts, key=lambda dict: dict["point"], reverse=True)[0]
            restPoint = G - sum
            one = min(-(-restPoint // dict["point"]), dict["n"])
            two = min(-(-restPoint // mxPointDict["point"]), mxPointDict["n"])
            if mxPointDict["point"] * mxPointDict["n"] + mxPointDict["bonus"] + sum < G:
                count += one
            else:
                count += min(one, two)
            break

    print(count)


if __name__ == '__main__':
    func()

Submission status: Wrong Answer

Solution code:
def func():
    D, G = map(int, input().split())
    dicts = []
    for i in range(1, D+1):
        n, bonus = map(int, input().split())
        point = i * 100
        cp = (point * n + bonus) / n
        dict = {"point": point, "n": n, "bonus": bonus, "cp": cp}
        dicts.append(dict)

    dicts.sort(key=lambda x: x["cp"], reverse=True)

    sum = 0
    count = 0
    while sum < G:
        dict = dicts.pop(0)
        totalPoints = dict["point"] * dict["n"] + dict["bonus"]
        if totalPoints + sum < G:
            sum += totalPoints
            count += dict["n"]
        elif len(dicts) == 0:
            restPoint = G - sum
            count += min(-(-restPoint // dict["point"]), dict["n"])
            break

        else:
            mxPointDict = sorted(
                dicts, key=lambda dict: dict["point"], reverse=True)[0]
            restPoint = G - sum
            one = min(-(-restPoint // dict["point"]), dict["n"])
            two = min(-(-restPoint // mxPointDict["point"]), mxPointDict["n"])
            if mxPointDict["point"] * dict["n"] + dict["bonus"] + sum < G:
                count += one
            else:
                count += min(one, two)
            break

    print(count)


if __name__ == '__main__':
    func()

Submission status: Wrong Answer

Solution code:
def func():
    D, G = map(int, input().split())
    dicts = []
    for i in range(1, D+1):
        n, bonus = map(int, input().split())
        point = i * 100
        cp = (point * n + bonus) / n
        dict = {"point": point, "n": n, "bonus": bonus, "cp": cp}
        dicts.append(dict)

    dicts.sort(key=lambda x: x["cp"], reverse=True)

    sum = 0
    count = 0
    while sum < G:
        dict = dicts.pop(0)
        totalPoints = dict["point"] * dict["n"] + dict["bonus"]
        if totalPoints + sum < G:
            sum += totalPoints
            count += dict["n"]
        elif len(dicts) == 0:
            restPoint = G - sum
            count += min(-(-restPoint // dict["point"]), dict["n"])
            break

        else:
            mxPointDict = sorted(
                dicts, key=lambda dict: dict["point"], reverse=True)[0]
            restPoint = G - sum
            one = min(-(restPoint // dict["point"]), dict["n"])
            two = min(-(restPoint // mxPointDict["point"]), mxPointDict["n"])
            if mxPointDict["point"] * dict["n"] + dict["bonus"] + sum < G:
                count += one
            else:
                count += min(one, two)
            break

    print(count)


if __name__ == '__main__':
    func()

Submission status: Wrong Answer

Solution code:
def func():
    D, G = map(int, input().split())
    dicts = []
    for i in range(1, D+1):
        n, bonus = map(int, input().split())
        point = i * 100
        cp = (point * n + bonus) / n
        dict = {"point": point, "n": n, "bonus": bonus, "cp": cp}
        dicts.append(dict)

    dicts.sort(key=lambda x: x["cp"], reverse=True)

    sum = 0
    count = 0
    while sum < G:
        dict = dicts.pop(0)
        totalPoints = dict["point"] * dict["n"] + dict["bonus"]
        if totalPoints + sum < G:
            sum += totalPoints
            count += dict["n"]
        elif len(dicts) == 0:
            restPoint = G - sum
            count += restPoint // dict["point"]
            break

        else:
            mxPointDict = sorted(
                dicts, key=lambda dict: dict["point"], reverse=True)[0]
            restPoint = G - sum
            one = min(restPoint // dict["point"], dict["n"])
            two = min(restPoint // mxPointDict["point"], mxPointDict["n"])
            if mxPointDict["point"] * dict["n"] + dict["bonus"] + sum < G:
                count += one
            else:
                count += min(one, two)
            break

    print(count)


if __name__ == '__main__':
    func()

Submission status: Wrong Answer

Solution code:
import copy
n, m = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
b = [((i+1)*100*name[0] + name[1]) for i, name in enumerate(a)]

m1 = copy.deepcopy(m)
a1 = copy.deepcopy(a)
ans = []

for i in range(0, (2**n)):
    y1 = bin(i)[2:].zfill(n)
    y2 = y1[y1.find("1"):]
    y3 = [i for i,name in enumerate(list(y2)) if name == "0"]
    if len(y3) > 1:
        continue
    else:
        sum1 = 0
        count = 0
        zeroin = []
        for j, name in enumerate(list(map(int, y1))):
            if name == 1:
                sum1 += b[j]
                count += a[j][0]
            else:
                zeroin.append(j)
        if sum1 >= m:
            ans.append(count)
        elif (m - sum1) > (a[zeroin[-1]][0] - 1) * (zeroin[-1] + 1) * 100:
            continue
        else:
            count += ((m - sum1) // ((zeroin[-1] + 1) * 100) )
            if (m - sum1) % ((zeroin[-1] + 1) * 100) != 0:
                count += 1
            ans.append(count)

print(min(ans))

Submission status: Wrong Answer

Solution code:
import itertools
import numpy as np

D,G = map(int,input().split(" "))
p = []
c = []
score_list = []
for i in range(D):
    p_,c_ = map(int,input().split(" "))
    p.append(p_)
    c.append(c_)
    for n in range(p_):
        score_list.append((i+1)*100)

ans = sum(p)

# 何個の問題をコンプリートボーナス取得まで解くかのループ
for i in range(1,len(score_list)):
    
    # コンプリートボーナスの組み合わせ
    comp_scores_pos = list(itertools.combinations(np.arange(len(c)),i))
    
    for cs in comp_scores_pos:        
        # 合計を計算（コンプリートボーナス）
        cs = list(cs)
        if len(cs) <= 1:
            score = c[cs[0]]
        else :
            score = sum(np.array(c)[cs])
        
        # 合計を計算（問題の得点）と問題数のカウント
        count = 0
        for n in cs:
            score += (n + 1) * 100 * p[n]
            count += p[n]
        
        # G以上か見て
        if score >= G:
            # 最小値を更新
            ans = min(ans, count)
        else:
            # 何個の問題を解けばGに届くか
            for j in range(D - 1, -1, -1):
                for k in range(p[j] - 1):
                    if cs.count(j) > 0:
                        continue
                    
                    score += (j + 1) * 100                    
                    count += 1
                    
                    if score >= G:
                        ans = min(ans, count)
                        break
                if score >= G:
                    break
    
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
import numpy as np

D,G = map(int,input().split(" "))
p = []
c = []
score_list = []
for i in range(D):
    p_,c_ = map(int,input().split(" "))
    p.append(p_)
    c.append(c_)
    for n in range(p_):
        score_list.append((i+1)*100)

ans = sum(p)

# 何個の問題をコンプリートボーナス取得まで解くかのループ
for i in range(1,len(score_list)):
    
    # コンプリートボーナスの組み合わせ
    comp_scores_pos = list(itertools.combinations(np.arange(len(c)),i))
    
    for cs in comp_scores_pos:        
        # 合計を計算（コンプリートボーナス）
        cs = list(cs)
        if len(cs) <= 1:
            score = c[cs[0]]
        else :
            score = sum(np.array(c)[cs])
        
        # 合計を計算（問題の得点）と問題数のカウント
        count = 0
        for n in cs:
            score += (n + 1) * 100 * p[n]
            count += p[n]
        
        # G以上か見て
        if score >= G:
            # 最小値を更新
            ans = min(ans, count)
#             print("ans = ", ans, ", count = ", count, ", cs = ", cs)
        else:
#             print("cs = ", cs, ", score = ", score, ", count = ", count)
            # 何個の問題を解けばGに届くか
            for j in range(D - 1, -1, -1):
                for k in range(p[j] - 1):
                    score += (j + 1) * 100
                    
#                     print("j = ", j, ", score = ", score)
                    count += 1
                    
                    if score >= G:
                        ans = min(ans, count)
#                         print("ans = ", ans, ", count = ", count, ", cs = ", cs)
                        break
                if score >= G:
                    break
#             print()
    
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
l = len(S)
if S[0]=="A" and "C" in S[2:l-1]:
  S.remove("A")
  S.remove("C")
  S = "".join(S)
  if S.islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Submission status: Wrong Answer

Solution code:
def main():
    D, G = [int(i) for i in input().split()]
    p = []
    c = []
    for i in range(D):
        pp, cc = [int(i) for i in input().split()]
        p.append(pp); c.append(cc)
    ans = 1e9
    for mask in range(1<<D):
        s = 0; num = 0; rest_max = -1
        for i in range(D):
            # どのビットが立っているか確認する
            if mask >> i & 1:
                # i 番目の問題を全完した時の点数を追加する
                s += 100 * (i+1) * p[i] + c[i]
                num += p[i]
            else:
                # ビットが立っていない点数が一番高い問題のメモ
                # 足りなかったらここから解いて点数を追加する
                # 残ったやつ 1 つだけを見ればばいい
                # なぜなら、bit全探索で、他のパターンは自動的に出るから
                rest_max = i
        if s < G:
            # rest_max 番目の点数をあらかじめ計算しておく
            s1 = 100 * (rest_max+1)
            # 目標 - 今まで解いた問題の得点 + rest_max 番目の問題の得点 - 1
            need = (G - s) // s1 # max になってはいけない
            if need >= p[rest_max]:
                continue
            num += need
        ans = min(ans, num)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
d,g=map(int, input().split())
table = []
alscr=0
cnt=0
for i in range(d):
  table.append( [(i+1) * 100] + list(map(int,input().split())) )
 
for i in range(0,d)[::-1]:
  scr=table[i][0]
  num=table[i][1]
  bns=table[i][2]
  for i in range(num):
    alscr+=scr
    cnt +=1
    if i == num-1:
      alscr += bns
    if alscr >= g:
      print(cnt)
      break
      
  else:
    continue
  break

Submission status: Wrong Answer

Solution code:
d,g=map(int, input().split())
table = []
alscr=0
cnt=0
for i in range(d):
  table.append( [(i+1) * 100] + list(map(int,input().split())) )

for i in range(0,d)[::-1]:
  scr=table[i][0]
  num=table[i][1]
  bns=table[i][2]
  for i in range(num):
    alscr+=scr
    cnt +=1
    if i == num-1:
      alscr += bns
    if alscr >= g:
      print(cnt)
      break

Submission status: Wrong Answer

Solution code:
import bisect
import itertools
D, G = [int(v) for v in input().split()]
P = []
C = []
for i in range(D):
    p, c = [int(v) for v in input().split()]
    P.append(p)
    C.append(c)

l = itertools.permutations(range(1, D + 1), D)
P2 = []
for i, p in enumerate(P):
    pl = []
    score = 0
    for j in range(p):
        score += (i + 1) * 100
        if j == p - 1:
            score += C[i]
        pl.append(score)
    P2.append(pl)
#print(P2)
P2up = [l[-1] for l in P2]
#print(P2up)

r = []
for l2 in l:
    g = G
    cnt = 0
    for i in l2:
        if g - P2up[i - 1] < 0:
            p =  bisect.bisect(P2[i - 1], g)
            if P2[i - 1][p - 1] == g:
                cnt += p
            else:
                cnt += p + 1
            break
        else:
            g -= P2up[i - 1]
            cnt += P[i - 1]
    r.append(cnt)
print(min(r))

Submission status: Wrong Answer

Solution code:
import itertools
D, G = map(int, input().split())
score_list = []
for i in range(D):
    p, c = map(int, input().split())
    score_list.append([(i + 1) * 100] * (p - 1) + [c + (i + 1) * 100])
full_score = [sum(i) for i in score_list]
per = list(itertools.permutations(range(D)))
ans = 10000
print(score_list)

for k in per:
    pro = 0
    sco = 0
    for i in k:
        if G >= sco + full_score[i]:
            sco += full_score[i]
            pro += len(score_list[i])
        else:
            for j in score_list[i]:
                sco += j
                pro += 1
                if sco >= G:
                    break
                else:
                    continue
        if sco >= G:
            break
        else:
            continue
    if ans > pro:
        ans = pro
    else:
        continue
print(ans)

Submission status: Wrong Answer

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

for i in reversed(range(D)):
    for j in range(p[i]):
        sco += 100 * (i + 1)
        pro += 1
        if G <= sco:
            break
    sco += c[i]
    if G <= sco:
        break

for i in range(D):
    if G <= score[i]:
        pro = min(p[i], pro)
    else:
        continue

print(pro)

Submission status: Wrong Answer

Solution code:
INF = float('inf')
d, g = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(d)]
def f(data, score, targets):
  from builtins import min
  from math import ceil
  if score <= 0:
    return 0
  result = INF
  for i in targets:
    t = ceil(score / ((i + 1) * 100))
    if t < data[i][0]:
      result = min(result, t)
  for i in range(len(targets)):
    j = targets[i]
    p, c = data[j]
    t = p + f(data, score - (j + 1) * 100 * p + c, targets[0:i] + targets[i + 1:])
    result = min(result, t)
  return result
print(f(data, g, list(range(len(data)))))

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
scores = []
for i in range(1, 1 + D):
    p, c = map(int, input().split())
    scores.append({'score': i * 100, 'bonus': c, 'problem': p})

n = len(scores)
bit = 0
problems = []
while bit < (1 << n):
    total_score = 0
    problem = 0
    for i in range(n):
        if bit & 1 << i:
            total_score += scores[i]['bonus'] + scores[i]['score'] * scores[i]['problem']
            problem += scores[i]['problem']

    if G <= total_score:
        problems.append(problem)

    bit += 1

scores = sorted(scores, reverse=True, key=lambda x: x['score'])
total_score = 0
total_problem = 0
for dic in scores:
    score = dic['score']
    problem = dic['problem']
    bonus = dic['bonus']

    total_score += score * problem
    total_problem += problem

    if G <= total_score:
        r = total_score - G
        total_problem -= r // score
        problems.append(total_problem)
        break

    total_score += bonus

print(min(problems))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

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

    i = D
    ans = 0
    while G > 0:
        # print(G, ans)
        tmp = G//(i*100)
        if tmp <= pc[i-1][0]:
            ans += tmp
            break
        else:
            G -= pc[i-1][0] * (i*100) + pc[i-1][1]
            ans += pc[i-1][0]
        i -= 1
    if ans == 0:
        print(1)
    else:
        print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

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

    i = D
    ans = 0
    while G > 0:
        # print(G, ans)
        tmp = G//(i*100)
        if tmp <= pc[i-1][0]:
            ans += tmp
            break
        else:
            G -= pc[i-1][0] * (i*100) + pc[i-1][1]
            ans += pc[i-1][0]
        i -= 1
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
from pprint import pprint

d, g = map(int, sys.stdin.readline().strip().split(" "))

p = []
c = []
for _ in range(d):
    p_i, c_i = map(int, sys.stdin.readline().strip().split(" "))
    p.append(p_i)
    c.append(c_i)

ans = 10 ** 9
for i in range(2**d):
    use = [0] * d
    for j in range(d):
        if ((i >> j) & 1):
            use[d - 1 - j] = 1
    # pprint(use)
    score = 0
    tmp_ans = 0
    max_i = -1
    for i, use_i in enumerate(use):
        if use_i:
            tmp_ans += p[i]
            score += p[i] * (i+1) * 100 + c[i]
        else:
            max_i = i
    # print("score:", score, " max_i:", max_i)
    if score < g  and max_i > -1:
        num = (g - score) // ((max_i+1) * 100)
        # print("num:", num)
        if num < p[max_i]:
            tmp_ans += num
            score += num * ((max_i+1) * 100)
    # print(tmp_ans, score)
    if score >= g:
        ans = min(ans, tmp_ans)
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
from pprint import pprint

d, g = map(int, sys.stdin.readline().strip().split(" "))

p = []
c = []
for _ in range(d):
    p_i, c_i = map(int, sys.stdin.readline().strip().split(" "))
    p.append(p_i)
    c.append(c_i)

ans = 10 ** 9
for i in range(2**d):
    use = [0] * d
    for j in range(d):
        if ((i >> j) & 1):
            use[d - 1 - j] = 1
    # pprint(use)
    score = 0
    tmp_ans = 0
    max_i = -1
    for i, use_i in enumerate(use):
        if use_i:
            tmp_ans += p[i]
            score += p[i] * (i+1) * 100 + c[i]
        else:
            max_i = i
    # print("score:", score, " max_i:", max_i)
    if score < g  and max_i > -1:
        # print("test:", (max_i+1) * 100 * (p[max_i] - 1))
        if g - score <= (max_i+1) * 100 * (p[max_i] - 1):
            num = (g - score) // ((max_i+1) * 100)
            # print("num:", num)
            tmp_ans += num
            score += num * ((max_i+1) * 100)
    # print(tmp_ans, score)
    if score >= g:
        ans = min(ans, tmp_ans)
        
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
d,g=map(int,input().split())
p=[]
c=[]
point=[]
for i in range(d):
  P,C=map(int,input().split())
  p.append(P)
  c.append(C)
for j in range(d):
  point.append([j,100*p[j]*(j+1)+c[j]])
point.sort(key=lambda x:-x[1])
score=0
cnt=0
for k in range(d):
  score+=point[k][1]
  cnt+=p[point[k][0]]
  if score==g:
    print(cnt)
    sys.exit()
  if score>g:
    if score-c[point[k][0]]-100*(point[k][0]+1)<g:
      print(cnt)
      sys.exit()
    else:
      shou=(score-c[point[k][0]]-g)//(100*(p[point[k][0]]+1))
      print(cnt-shou)
      sys.exit()

Submission status: Wrong Answer

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

p.reverse()
c.reverse()

getPoint = 0
counter = 0

for i, p_ in enumerate(p):
    for j in range(p_):
        getPoint += (D - i) * 100
        counter += 1
        if getPoint >= G:
            print(counter)
            exit()
    getPoint += c[i]
    if getPoint >= G:
        print(counter)
        exit()

Submission status: Wrong Answer

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

p.reverse()
c.reverse()

getPoint = 0
counter = 0

for i, p_ in enumerate(p):
    for j in range(p_):
        getPoint += (D - i) * 100
        counter += 1
        if getPoint >= G:
            print(counter)
            exit()
    print(c[:])
    getPoint += c[i]
    if getPoint >= G:
        print(counter)
        exit()

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p = [0]
c = [0]
max_point = [0]
efficiency = [0]
for i in range(d):
  _p, _c = map(int, input().split())
  p.append(_p)
  c.append(_c)
  mp = _p * (i + 1) * 100 + _c
  max_point.append(mp)
  efficiency.append(mp / _p)

ef_sorted = sorted(efficiency[1:], reverse=True)
import math
s = 0
i = 0
j_max = d
cnt = 0
while s < g:
  if p[j_max] * j_max * 100 >= g - s:
    print('p1, selected={}'.format(j_max))
    cnt += math.ceil((g - s) / (j_max * 100))
    break
    
  elif max_point[j_max] >= g - s:
    print('p2, selected={}'.format(j_max))
    cnt += p[j_max]
    break
  
  else:
    pre_cnt = 10**10
    pre_k = 0
    for k, m in enumerate(max_point):
      if m > g - s:
        if p[k] <= pre_cnt:
          pre_k = k
          pre_cnt = p[k]
          
    if pre_k != 0:
      cnt += pre_cnt
      print('p2.5, selected={}'.format(pre_k))
      break  
        
    j = efficiency.index(ef_sorted[i])
    print('p3, selected={}'.format(j))
    s += max_point[j]
    cnt += p[j]
    max_point[j] = 0
    p[j] = 0
    c[j] = 0
    if j == j_max:
      for _j in range(j_max-1, 0, -1):
        if p[_j] != 0:
          j_max = _j
          break
    
  i += 1

print(cnt)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
d, g = map(int, input().split())
# D個の整数ペアを入力
p = [0]*d
c = [0]*d
ag_score = [0]*d
min_prob = 0
for i in range(d):
    p[i], c[i] = map(int, input().split())
    min_prob += p[i]
    ag_score[i] = (i+1) * 100 * p[i] + c[i]

for j in range(2**d):
    score = 0
    tmp_min_prob = 0
    # 1問も解かない点数帯の中で最も高得点の物を覚えておく
    max_na = 0
    for i in range(d):
        # 1ならこの点数の問題は完答する
        if (j >> i) & 1:
            score += ag_score[i]
            tmp_min_prob += p[i]
        # 0ならこの点数の問題は1問も解かない
        else:
            max_na = i+1
    if score < g:
        diff = g - score
        req_num = diff // (max_na * 100)
        # 1問も解いていない点数帯を完答まではせずに条件を満たせるかチェック
        if req_num < p[max_na - 1]:
            tmp_min_prob += req_num
        # 問題数がたりてなければ次のループへ
        else:
            continue
    # 暫定の最少問題数よりこのループの問題数が少なければ更新
    if min_prob > tmp_min_prob:
        min_prob = tmp_min_prob

print(min_prob)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
d, g = map(int, input().split())
# D個の整数ペアを入力
p = [0]*d
c = [0]*d
ag_score = [0]*d
min_prob = 0
for i in range(d):
    p[i], c[i] = map(int, input().split())
    min_prob += p[i]
    ag_score[i] = (i+1) * 100 * p[i] + c[i]

for j in range(d*d):
    score = 0
    tmp_min_prob = 0
    # 1問も解かない点数帯の中で最も高得点の物を覚えておく
    max_na = 0
    for i in range(d):
        # 1ならこの点数の問題は完答する
        if (j >> i) & 1:
            score += ag_score[i]
            tmp_min_prob += p[i]
        # 0ならこの点数の問題は1問も解かない
        else:
            max_na = i+1
    if score < g:
        diff = g - score
        req_num = diff // (max_na * 100)
        # 1問も解いていない点数帯を完答以外せずに条件を満たせるかチェック
        if req_num < p[max_na - 1]:
            tmp_min_prob += req_num
        # 問題数がたりてなければ次のループへ
        else:
            continue
    # 暫定の最少問題数よりこのループの問題数が少なければ更新
    if min_prob > tmp_min_prob:
        min_prob = tmp_min_prob

print(min_prob)