Problem:


Score : 300 points

Problem Statement

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

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

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

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

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

Constraints

1 ≤ D ≤ 10

1 ≤ p_i ≤ 100

100 ≤ c_i ≤ 10^6

100 ≤ G

All values in input are integers.

c_i and G are all multiples of 100.

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

Input

Input is given from Standard Input in the following format:

D G
p_1 c_1
:
p_D c_D

Output

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

Sample Input 1

2 700
3 500
5 800

Sample Output 1

3

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

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

Sample Input 2

2 2000
3 500
5 800

Sample Output 2

7

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

Sample Input 3

2 400
3 500
5 800

Sample Output 3

2

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

Sample Input 4

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

Sample Output 4

66

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



Sample input:
2 700
3 500
5 800


Sample output:
3

Submission status: Wrong Answer

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

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

x = 0
y = 0
z = 0
xcount = 0

#大きいものから順番に
for v in range(d, 0, -1):
    for i in range(1, k[v - 1][0] + 1):
        x += 100 * v
        if i == k[v - 1][0]:
            x += k[v - 1][1]
        xcount += 1
        if x >= g:
            break
    else:
        continue
    break

#print(xcount)

#ボーナスこみでpiだけで賄えるものも個数が最小のもの
m = []
n = []
for j in range(d):
    m.append(100 * (j + 1) * k[j][0] + k[j][1])
    n.append(k[j][0])

p = []
q = []
r = []
for j in range(len(m)):
    if m[j] >= g:
        p.append(n[j])
    else:
        q.append(m[j])
        r.append(n[j])

if p != []:
    ycount = min(p)
else:
    ycount = 1001
#print(ycount)

#ボーナスこみでpiだけで賄えないものと大きいのを足した個数が最小のもの
zcount = 0
add = 0
zar = []
addar = []
h = d - 1
proh = 0

R = sum(r)
hiku = 0
arc = [0 for i in range(d)]
for j in range(len(q)):
    add = q[j]
    comp = q[j]
    for w in range(1, R + 1):
        for u in range(len(q)):
            #qaz = w - hiku
            if h == j:
                h -= 1
            if w == r[u] and j != u:#満タンにぴったり一致するときボーナス分と今までと最大のやつを比較
                if add + 100 * (h + 1) - comp < q[u]:#100 * w * (h + 1)
                    addar.append(q[u])
                    if h == u:
                        proh = 1
                    #100 * d * (w - 1 - pom[pomcount])
                    #pom.append(w - 1)
                    #pomcount += 1
            if u == len(q) - 1 and addar != []:
                add = add + max(addar) - (add - comp) #+ q[j]
                #comp = add
                arc[q.index(max(addar))] += 1
                arc = [0 for i in range(d)]
                arc[q.index(max(addar))] = w
                for m in range(len(q)):
                    if arc[m] < k[m][0] and m != j:
                        h = m
            if u == len(q) - 1 and addar == []:
                add += 100 * (h + 1)
                arc[h] += 1
        zcount += 1
        if arc[h] == k[h][0]:
            hiku += arc[h]
            if proh == 0:
                add += k[h][1]
            h -= 1
            if h == j:
                h -= 1
        proh = 0
        addar = []
        if add >= g:
            zar.append(zcount + r[j])
            zcount = 0

            h = d - 1
            arc = [0 for i in range(d)]
            comp = 0
            hiku = 0
            break

if zar != []:
    coz = min(zar)
else:
    coz = 1001
#print(coz)


print(min(xcount, ycount, coz))

Submission status: Wrong Answer

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

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

x = 0
y = 0
z = 0
xcount = 0

#大きいものから順番に
for v in range(d, 0, -1):
    for i in range(1, k[v - 1][0] + 1):
        x += 100 * v
        if i == k[v - 1][0]:
            x += k[v - 1][1]
        xcount += 1
        if x >= g:
            break
    else:
        continue
    break

#print(xcount)

#ボーナスこみでpiだけで賄えるものも個数が最小のもの
m = []
n = []
for j in range(d):
    m.append(100 * (j + 1) * k[j][0] + k[j][1])
    n.append(k[j][0])

p = []
q = []
r = []
for j in range(len(m)):
    if m[j] >= g:
        p.append(n[j])
    else:
        q.append(m[j])
        r.append(n[j])

if p != []:
    ycount = min(p)
else:
    ycount = 1001
#print(ycount)

#ボーナスこみでpiだけで賄えないものと大きいのを足した個数が最小のもの
zcount = 0
add = 0
zar = []
h = d - 1
arc = [0 for i in range(d)]
for j in range(len(q)):
    add = q[j]
    for w in range(max(r) + 1):
        for u in range(len(q)):
            if h == j:
                h -= 1
            if w == r[u] and j != u:#満タンにぴったり一致するときボーナス分と今までと最大のやつを比較
                if add + 100 * (h + 1) < q[u]:
                    add = q[u] #100 * d * (w - 1 - pom[pomcount])
                    #pom.append(w - 1)
                    #pomcount += 1
                else:
                    add += 100 * (h + 1)
            else:
                add += 100 * (h + 1)
            arc[h] += 1
            zcount += 1
            if arc[h] == k[h][0]:
                add += k[h][1]
                h -= 1
                if h == j:
                    h -= 1
            if add >= g:
                zar.append(zcount + r[j])
                zcount = 0
                h = d - 1
                arc = [0 for i in range(d)]
                break

        else:
            continue
        break

if zar != []:
    coz = min(zar)
else:
    coz = 1001
#print(coz)


print(min(xcount, ycount, coz))

Submission status: Wrong Answer

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

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

x = 0
y = 0
z = 0
xcount = 0

#大きいものから順番に
for v in range(d, 0, -1):
    for i in range(1, k[v - 1][0] + 1):
        x += 100 * v
        if i == k[v - 1][0]:
            x += k[v - 1][1]
        xcount += 1
        if x >= g:
            break
    else:
        continue
    break

#print(xcount)

#ボーナスこみでpiだけで賄えるものも個数が最小のもの
m = []
n = []
for j in range(d):
    m.append(100 * (j + 1) * k[j][0] + k[j][1])
    n.append(k[j][0])

p = []
q = []
r = []
for j in range(len(m)):
    if m[j] >= g:
        p.append(n[j])
    else:
        q.append(m[j])
        r.append(n[j])

if p != []:
    ycount = min(p)
else:
    ycount = 1001
#print(ycount)


print(min(xcount, ycount))

Submission status: Wrong Answer

Solution code:
(d, g) = map(int, input().split())
points = {0:0}
pc = []
for i in range(d):
    pc.append(list(map(int, input().split())))
for i in range(d, 0, -1):
    ip = i * 100
    for k in range(len(points)):
        for j in range(1, pc[i-1][0] + 1):
            ijp = ip * j
            if j == pc[i-1][0]:
                ijp +=  pc[i-1][1]
            if k + j in points:
                points[k + j] = max(points[k + j] , points[k] + ijp)
            else:
                points[k + j] = points[k] + ijp
dct = sorted(points.items())
for i in range(1, len(dct) + 1):
    if points[i] >= g:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
(d, g) = map(int, input().split())
points = {0:0}
 
pc = []
for i in range(d):
    pc.append(list(map(int, input().split())))
 
for i in range(d, 0, -1):
    ip = i * 100
 
    for k in range(len(points)):
        for j in range(1, pc[i-1][0] + 1):
            ijp = ip * j
            if j == pc[i-1][0]:
                ijp +=  pc[i-1][1]
            if k + j in points:
                points[k + j] = max(points[k + j] , points[k] + ijp)
            else:
                points[k + j] = points[k] + ijp
for i in range(1, len(points) + 1):
    if points[i] >= g:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
(d, g) = map(int, input().split())
points = {0:0}
 
pc = []
for i in range(d):
    pc.append(list(map(int, input().split())))
 
for i in range(d, 0, -1):
    ip = i * 100
 
    for k in range(len(points)):
        for j in range(1, pc[i-1][0] + 1):
            ijp = ip * j
            if j == pc[i-1][0]:
                ijp +=  pc[i-1][1]
            if k + j in points:
                points[k + j] = max(points[k + j] , points[k] + ijp)
            else:
                points[k + j] = points[k] + ijp
for i in range(1, len(points)):
    if points[i] >= g:
        print(i)
        break

Submission status: Wrong Answer

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

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

for i in range(d, 0, -1):
    ip = i * 100

    for k in range(len(points)):
        for j in range(1, pc[i-1][0] + 1):
            ijp = ip * j

            if j == pc[i-1][0]:
                ijp +=  pc[i-1][1]
            if k + j in points:
                points[k + j] = max(points[k + j] , points[k] + ijp)
            else:
                points[k + j] = points[k] + ijp
for i in range(len(points)):
    if points[i] >= g:
        print(i)
        break

Submission status: Wrong Answer

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

m=0,0,0
mondai=[]
for i in range(2**D,2**(D+1)):
    s=(bin(i))[3:]
    a,b=0,0
    for j in range(D):
        if s[j]=='1':
            a,b=a+p[j],b+100*(j+1)*p[j]+c[j]
        else:
            m=j
    if G<=b:
        mondai.append(a)
    if G-p[m]*100*(m+1)<b<G:
        ad=(G-b)//(100*(m+1))
        mondai.append((a+ad))
print(min(mondai))

Submission status: Wrong Answer

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

m=0,0,0
mondai=[]
for i in range(2**D,2**(D+1)):
    s=(bin(i))[3:]
    a,b=0,0
    for j in range(D):
        if s[j]=='1':
            a,b=a+p[j],b+100*(j+1)*p[j]+c[j]
        else:
            m=j
    if G<=b:
        mondai.append(a)
    if G-p[m]*100*(m+1)<=b<G:
        ad=(G-b)//(100*(m+1))
        mondai.append((a+ad))
print(min(mondai))

Submission status: Wrong Answer

Solution code:
import itertools

def combination(d):
    dd = [i for i in range(d)]
    return [itertools.combinations(dd, i) for i in range(1, d + 1)]

def all_green(d, g, ps, cs):
    # tood use int max value or other constant value
    min_count = 1000000
    for cc in combination(d):
        for c in cc:
            v = 0
            count = 0
            for ccc in c:
                v += cs[ccc]
                v += (ccc + 1) * 100 * ps[ccc]
                count += ps[ccc]
            if v >= g:
                if count < min_count:
                    min_count = count
                continue
            if count >= min_count:
                continue

            dd = [i if i not in c else None for i in range(d)]
            dd = list(filter(lambda x: x is not None, dd))
            for vvv in reversed(dd):
                for _ in range(ps[vvv]):
                    v += 100 * (vvv + 1)
                    count += 1
                    if v >= g:
                        if count < min_count:
                            min_count = count
                        break
                if count >= min_count:
                    break
    return min_count

d, g = map(int, input().split())
ps = []
cs = []
for _ in range(d):
    p, c = map(int, input().split())
    ps += [p]
    cs += [c]
print(all_green(d, g, ps, cs))

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
minN = None
plist = []
clist = []
for i in range(D):
    p, c = map(int,input().split())
    plist.append(p)
    clist.append(c)
OverPoint = 0
Over = False
count = 0
lenp = len(plist)
sum = 0
for i in range(D)[::-1]:
    for j in range(plist[i]):
        count += 1
        sum += (i+1)*100
        if j == plist[i] -1:
            sum += clist[i]
        if sum >= G:
            if minN == None:
                minN = int(count)
            elif minN > count:
                minN = count
            count = 0
            sum = 0
            if Over == True:
                Over = False
                i = OverPoint
                OverPoint = 0
            break
        Over = True
        if OverPoint == 0:
            OverPoint = i-1
print(minN)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
minN = None
plist = []
clist = []
for i in range(D):
    p, c = map(int,input().split())
    plist.append(p)
    clist.append(c)
Over = False
count = 0
lenp = len(plist)
sum = 0
for i in range(D)[::-1]:
    for j in range(plist[i]):
        count += 1
        sum += (i+1)*100
        if j == plist[i] -1:
            sum += clist[i]
        if sum >= G:
            if minN == None:
                minN = int(count)
            elif minN > count:
                minN = count
            count = 0
            sum = 0
            if Over == True:
                Over = False
                i  = i+1
            break
        Over = True
print(minN)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
minN = None
plist = []
clist = []
for i in range(D):
    p, c = map(int,input().split())
    plist.append(p)
    clist.append(c)

count = 0
lenp = len(plist)
sum = 0
for i in range(D)[::-1]:
    #print(plist[i])
    for j in range(plist[i]):
        #print(j)
        count += 1
        sum += (i+1)*100
        if j == plist[i] -1:
            sum += clist[i]
            #print("last question complete")
            #print("sum = sum + "+str(clist[i]))
        #print("sum = "+str(sum))
        if sum >= G:
            #print("G Over")
            if minN == None:
                minN = int(count)
            elif minN > count:
                minN = count
            #print("minN = "+str(minN))
            count = 0
            sum = 0
            break
            
print(minN)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
p = []
c = []
cscore = []
ans = []

#各得点帯の問題を完答したときの点数をcscoreに入れる
for i in range(D):
    pi, ci = map(int, input().split())
    p.append(pi)
    c.append(ci)
    score = pi * (i+1) * 100 + ci
    cscore.append(score)

#各得点帯を完答する組み合わせ全パターン試してその総得点をtotscoreに入れる
totscore = []
for i in range(1 << len(cscore)):
    output = []
    for j in range(len(cscore)):
        if ((i >> j) & 1) == 1:
            output.append(cscore[j])
    tot = 0
    for i in range(len(output)):
        tot += output[i]
    totscore.append(tot)
#totscoreの各場合においてそれぞれ解くべき問題数を計算
for i in range(len(totscore)):
    problems = 0
    b = format(i, "b").zfill(D)

    #完答のみで目標得点を超えている場合はその問題数を計算
    if totscore[i] >= G:
        for k in range(D):
            problems += p[k] * int(b[D-1-k])
        ans.append(problems)

    #完答のみで目標得点を超えていない場合は得点の高い方から問題を1問ずつ解いていく
    else:
        remainscore = G - totscore[i]
        for k in range(D):
            problems += p[k] * int(b[D-1-k])
        for l in range(D, 1, -1):
            if int(b[D-l]) == 0:
                for m in range(p[l-1]):
                    if remainscore > 0:
                        remainscore -= l * 100
                        problems += 1
        ans.append(problems)

#最小値を出力
print(min(ans))

Submission status: Wrong Answer

Solution code:
import itertools
from collections import Counter
D, G = map(int, input().split())
P = [list(map(int, input().split())) for i in range(D)]
min_num = 10**8

judge_list = list(itertools.product([0, 1, 2], repeat=D)) #0:中途半端に解く 1:一問も解かない 2: 全部解く


for judge in judge_list:
    score = 0
    num = 0
    d = Counter() #インスタンスを生成
    d.update(judge)
    print(d)
    if (d[0] <= 1):
        for i in range(1, len(judge) + 1):
            if score >= G:
                break

            if judge[-i] == 1:
                pass

            if judge[-i] == 2:
                score += P[-i][0] * (D - i + 1) * 100 + P[-i][1]
                num += P[-i][0]

            if (judge[-i] == 0):
                for j in range(P[-i][0]):
                    if score >= G:
                        break
                    score += 100 * (D - i + 1)
                    num += 1

        if score >= G:
            min_num = min(num, min_num)

print(min_num)

Submission status: Wrong Answer

Solution code:
# ABC 104 C
# bit
import math
D, G = map(int, input().split())
S = [list(map(int, input().split())) for k in range(D)]

ans = float("inf")
for k in range(2**D):
    temp_score = 0
    temp_ans = 0
    r = -1
    for l in range(D):
        if int(bin(k>>l)[-1]):
            temp_score += (l+1)*100*S[l][0] + S[l][1]
            temp_ans += S[l][0]
        else:
            r = l
    if temp_score < G:
        if G-temp_score <= (r+1)*(S[r][0]-1)*100:
            temp_ans += math.ceil((G-temp_score)//((r+1)*100))
        else:
            temp_ans = float("inf")
    ans = min(ans,temp_ans)

print(ans)

Submission status: Wrong Answer

Solution code:
from math import floor

D, G = map(int, input().split())
p, c = [], []
for _ in range(D):
  pi, ci = map(int, input().split())
  p.append(pi)
  c.append(ci)
  

ans = int(1e9)
for mask in range(1 << D):
    s = 0 # sum of points
    num = 0 # num of problems
    rest_max = D -1 # index of max which I don't use all 
    
    for i in range(D):
        if mask >> i & 1:
            s += 100 * (i+1) * p[i] + c[i]
            num += p[i]
        else:
            rest_max = i

        if s < G:
            rest = G - s 
            need = floor(rest / (100 * (rest_max + 1)))
            if need >= p[rest_max]:
                continue
            num += need
        ans = min(ans, num)
    
print(ans)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


D, G = inpl()
P, C = [], []
for i in range(D):
    p, c = inpl()
    P.append(p)
    C.append(c)

ans = INF
for i in range(D ** 2):
    point = 0
    cnt = 0
    rest_max = 0
    for shift in range(D):
        if i >> shift & 1:
            cnt += P[shift]
            point += (shift + 1) * 100 * P[shift] + C[shift]
        else:
            rest_max = shift

    if point < G:
        for j in range(P[rest_max]):
            if point >= G:
                break
            cnt += 1
            point += (rest_max + 1) * 100

    if point >= G:
        ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
import math
d,g = map(int, input().split())
list_prob = []
for i in range(0,d):
    list_prob.append(list((map(int,input().split()))))
#print(list_prob)

list_sum = [0]*d
for i in range(0,d):
    list_sum[i] = (i+1) * 100 * list_prob[i][0] + list_prob[i][1]
#print(list_sum)

list_perf = [0]*d
for i in range(0,d):
    list_perf[i] = list_sum[i] / list_prob[i][0]
#print(list_perf)
count = 0
max_perf = max(list_perf)
idx = list_perf.index(max_perf)
while g >= list_sum[idx]:
    g -= list_sum[idx]
    count += list_prob[idx][0]
    list_perf[idx] = 0
    list_sum[idx] = 0
    list_prob[idx] = [0,0]
    max_perf = max(list_perf)
    idx = list_perf.index(max_perf)
count_list = [0]*d
#print(list_prob)
#print(g)
#print(list_sum)
for i in range(0,d):
    if g > list_sum[i]:
        count_list[i] = 10**9
    elif g > list_prob[i][0] * (i+1) * 100:
        count_list[i] = list_prob[i][0]
    else:
        count_list[i] = g / (100*(i+1))
#print(count_list)
#print(count)
min_count = min(count_list)
print(int(count + min_count))

Submission status: Wrong Answer

Solution code:
import math

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

ans = 1e20
for i in range(2**D - 1):
    inSolve = -1
    score_tmp = 0
    solved = 0
    for j in range(D):
        if (i>>j)%2 == 1:
            score_tmp += (j+1)*100*PC[j][0]+PC[j][1]
            solved += PC[j][0]
        else:
            inSolve = max(j,inSolve)
    if score_tmp < G and inSolve != -1:
        if math.ceil((G-score_tmp)/((inSolve+1)*100)) <= PC[inSolve][0]:
            ans = min(ans,solved + math.ceil((G-score_tmp)/((inSolve+1)*100)))
    elif score_tmp >= G:
        ans = min(ans,solved)
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

ans = 1e10
for i in range(2**D - 1):
    inSolve = -1
    score_tmp = 0
    solved = 0
    for j in range(D):
        if (i>>j)%2 == 1:
            score_tmp += (j+1)*100*PC[j][0]+PC[j][1]
            solved += PC[j][0]
        else:
            inSolve = max(j,inSolve)
    if score_tmp < G and inSolve != -1:
        if math.ceil((G-score_tmp)/((inSolve+1)*100)) <= PC[inSolve][0]:
            ans = min(ans,solved + math.ceil((G-score_tmp)/((inSolve+1)*100)))
    elif score_tmp >= G:
        ans = min(ans,solved)
print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

ans = 1e9
for i in range(2**D - 1):
    inSolve = -1
    score_tmp = 0
    solved = 0
    for j in range(D):
        if (i>>j)%2 == 1:
            score_tmp += (j+1)*100*PC[j][0]+PC[j][1]
            solved += PC[j][0]
        else:
            inSolve = max(j,inSolve)
    if score_tmp < G and inSolve != -1:
        if math.ceil((G-score_tmp)/((inSolve+1)*100)) <= PC[inSolve][0]:
            ans = min(ans,solved + math.ceil((G-score_tmp)/((inSolve+1)*100)))
    elif score_tmp >= G:
        ans = min(ans,solved)
print(ans)

Submission status: Wrong Answer

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

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 = 10 ** 10
# 0:一問も解かない 1:全部解く
masks = list(itertools.product([0, 1], repeat=D))

for mask in masks:
    point = sum(((i + 1) * 100 * p[i] + c[i]) * mask[i] for i in range(D))
    count = sum(p[i] * mask[i] for i in range(D))
    # 完全に解いたものだけでGを超えていればcountを採用、そうでなければ使ってない点の問題のうち最大のものを
    if point < G:
        if all(mask):
            continue
        # まだ使ってない点数のうちの最大値
        i = [i for i, j in enumerate(mask) if j == 0][-1]
        if point + (i + 1) * 100 * (p[i]) < G:
            # 全部たしてもGを超えないなら次
            continue
        count += (G - point) // ((i + 1) * 100)

    ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

def main():
	d, g = list(map(int, input().split()))
	problems = [list(map(int, input().split())) for _ in range(d)]

	ptns = itertools.product([0, 1], repeat = d)
	#print(list(ptns))

	ans = sum([x[0] for x in problems])

	if sum([(i + 1) * 100 * problems[i][0] for i in range(d)]) == g:
		print(sum([x[1] for x in problems]))
		return

	for pt in ptns:
		#print(pt)
		rest = g - sum([((i + 1) * 100 * problems[i][0] + problems[i][1]) * pt[i] for i in range(d)])
		tmp = sum([problems[i][0] * pt[i] for i in range(d)])
		
		if rest > 0:
			if 0 in pt:
				rest_max_idx = d - pt[::-1].index(0) - 1
			
			for i in range(problems[rest_max_idx][0]):
				rest -= (rest_max_idx + 1) * 100
				tmp += 1
				if rest <= 0:
					break

		if rest <= 0:
			ans = min(ans, tmp)

	print(ans)


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import itertools

def main():
	d, g = list(map(int, input().split()))
	problems = [list(map(int, input().split())) for _ in range(d)]

	ptns = itertools.product([0, 1], repeat = d)
	#print(list(ptns))

	ans = sum([x[0] for x in problems])

	if sum([(i + 1) * 100 * problems[i][0] for i in range(d)]) == g:
		print(sum([x[1] for x in problems]))
		return

	for pt in ptns:
		#print(pt)
		rest = g - sum([((i + 1) * 100 * problems[i][0] + problems[i][1]) * pt[i] for i in range(d)])
		tmp = sum([problems[i][0] * pt[i] for i in range(d)])
		
		if rest > 0:
			if 0 in pt:
				rest_max_idx = d - pt[::-1].index(0) - 1
			
			for i in range(1, problems[rest_max_idx][0]):
				rest -= (rest_max_idx + 1) * 100
				tmp += 1
				if rest <= 0:
					break

		if rest <= 0:
			ans = min(ans, tmp)

	print(ans)


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import itertools

def main():
	d, g = list(map(int, input().split()))
	problems = [list(map(int, input().split())) for _ in range(d)]

	ptns = itertools.product([0, 1], repeat = d)
	#print(list(ptns))

	ans = 10 ** 10

	if sum([(i + 1) * 100 * problems[i][0] for i in range(d)]) == g:
		print(sum([x[1] for x in problems]))
		return

	for pt in ptns:
		#print(pt)
		rest = g - sum([((i + 1) * 100 * problems[i][0] + problems[i][1]) * pt[i] for i in range(d)])
		tmp = sum([problems[i][0] * pt[i] for i in range(d)])
		
		if rest > 0:
			if 0 in pt:
				rest_max_idx = d - pt[::-1].index(0) - 1
			
			for i in range(1, problems[rest_max_idx][0]):
				rest -= (rest_max_idx + 1) * 100
				tmp += 1
				if rest <= 0:
					break

		if rest <= 0:
			ans = min(ans, tmp)

	print(ans)


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import itertools

def main():
	d, g = list(map(int, input().split()))
	problems = [list(map(int, input().split())) for _ in range(d)]

	ptns = itertools.product([0, 1], repeat = d)
	#print(list(ptns))

	ans = 10 ** 10

	if sum([(i + 1) * 100 * problems[i][0] for i in range(d)]) == g:
		print(sum([x[1] for x in problems]))
		return

	for pt in ptns:
		#print(pt)
		rest = g - sum([((i + 1) * 100 * problems[i][0] + problems[i][1]) * pt[i] for i in range(d)])
		tmp = sum([problems[i][0] * pt[i] for i in range(d)])
		
		if rest > 0:
			if 0 in pt:
				rest_max_idx = d - pt[::-1].index(0) - 1
			
			for i in range(problems[rest_max_idx][0]):
				rest -= (rest_max_idx + 1) * 100
				tmp += 1
				if rest <= 0:
					break

		if rest <= 0:
			ans = min(ans, tmp)

	print(ans)


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import itertools

def main():
	d, g = list(map(int, input().split()))
	problems = [list(map(int, input().split())) for _ in range(d)]

	ptns = itertools.product([0, 1], repeat = d)
	#print(list(ptns))

	ans = 10 ** 10

	if sum([(i + 1) * 100 * problems[i][0] for i in range(d)]) == g:
		print(sum([x[1] for x in problems]))
		return

	for pt in ptns:
		#print(pt)
		rest = g - sum([((i + 1) * 100 * problems[i][0] + problems[i][1]) * pt[i] for i in range(d)])
		tmp = sum([problems[i][0] * pt[i] for i in range(d)])
		
		if 0 in pt:
			rest_max_idx = d - pt[::-1].index(0) - 1
			#print(pt, rest_max_idx)
			
		if rest > 0:
			#print(rest)
			if rest > 100 * (rest_max_idx + 1) * problems[rest_max_idx][0]:
				continue
			else:
				tmp += (rest - 0.1) // ((rest_max_idx + 1) * 100) + 1

		#print (pt, tmp)
		ans = min(ans, tmp)

	print(ans)


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import itertools

def main():
	d, g = list(map(int, input().split()))
	problems = [list(map(int, input().split())) for _ in range(d)]

	ptns = itertools.product([0, 1], repeat = d)
	#print(list(ptns))

	ans = 10 ** 10

	for pt in ptns:
		#print(pt)
		rest = g - sum([((i + 1) * 100 * problems[i][0] + problems[i][1]) * pt[i] for i in range(d)])
		tmp = sum([problems[i][0] * pt[i] for i in range(d)])
		
		if 0 in pt:
			rest_max_idx = d - pt[::-1].index(0) - 1
			#print(pt, rest_max_idx)
			
		if rest > 0:
			#print(rest)
			if rest > 100 * (rest_max_idx + 1) * problems[rest_max_idx][0]:
				continue
			else:
				tmp += (rest + 1) // ((rest_max_idx + 1) * 100)

		#print (pt, tmp)
		ans = min(ans, tmp)

	print(ans)


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
S = input()

if S[0] == "A" and S[2:-1].count("C") == 1:
    i =  S.index("C")
    S = S[1:i] + S[i+1:]
    if S.islower():
        print("AC")
    else:
        print("WA")
else:
        print("WA")

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
pc=[list(map(int, input().split())) for _ in range(d)]
t1=[bin(2**d+i)[3::] for i in range(2**d)]
a=[]
for t in t1:
    ta=0
    tb=0
    for i in range(d):
        if t[i]=='1':
            ta+=pc[i][0]
            tb+=100*pc[i][0]*(i+1)+pc[i][1]
    if tb>=g:
        a.append(ta)
    else:
        for i in range(d-1,-1,-1):
            if t[i]=='0':
                if 100*(i+1)*pc[i][0]>=g-tb:
                    ta+=(g-tb)//(100*(i+1))
                    tb+=100*(i+1)*((g-tb)//(100*(i+1)))
                break
        if tb>=g:
            a.append(ta)
print(min(a))

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
pc=[list(map(int, input().split())) for _ in range(d)]
t1=[bin(2**d+i)[3::] for i in range(2**d)]
a=[]
for t in t1:
    ta=0
    tb=0
    for i in range(d):
        if t[i]=='1':
            ta+=pc[i][0]
            tb+=100*pc[i][0]*(i+1)+pc[i][1]
    if tb>=g:
        a.append(ta)
    else:
        for i in range(d-1,-1,-1):
            if t[i]=='0':
                if 100*(i+1)*pc[i][0]>=g-tb:
                    ta+=int((g-tb)/(100*(i+1)))
                    tb+=100*int((g-tb)/(100*(i+1)))*(i+1)
                break
        if tb>=g:
            a.append(ta)
print(min(a))

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
pc=[list(map(int, input().split())) for _ in range(d)]
t1=[bin(2**d+i)[3::] for i in range(2**d)]
a=[]
for t in t1:
    ta=0
    tb=0
    for i in range(d):
        if t[i]=='1':
            ta+=pc[i][0]
            tb+=100*pc[i][0]*(i+1)+pc[i][1]
    if tb>=g:
        a.append(ta)
    else:
        for i in range(d-1,-1,-1):
            if t[i]=='0':
                if 100*(i+1)*pc[i][0]>g-tb:
                    ta+=int((g-tb)/(100*(i+1)))
                    tb+=100*int((g-tb)/(100*(i+1)))*(i+1)
                break
        if tb>=g:
            a.append(ta)
print(min(a))