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 math import ceil

class Score():
    def __init__(self, score, num, bonus):
        self.num = num
        self.score = score
        self.bonus = bonus

D, G = [int(c) for c in input().split(" ")]
min_times = 100000000

def dfs(score_lists, masks: list, num: int, sum_score, sum_use_num):
    """completeするかしないかで2^Dを選んでいく
    """
    if (num == D):
        # print(sum_score)
        for i in range(D - 1, -1, -1):
            if (masks[i] == 1):
                continue
            else:
                global min_times
                if sum_score >= G:
                    min_times = min(min_times, sum_use_num)
                elif sum_score + score_lists[i].num * score_lists[i].score < G:
                    break
                else:
                    min_times = min(sum_use_num + ceil((G - sum_score) / score_lists[i].score), min_times)
                    break
                    
    else:
        masks[num] = 0
        dfs(score_lists, masks, num + 1, sum_score, sum_use_num)

        masks[num] = 1
        dfs(score_lists, masks, num + 1, \
            sum_score + score_lists[num].num * score_lists[num].score + score_lists[num].bonus, \
            sum_use_num + score_lists[num].num)


score_lists = []
min_num = 0
left_score = G
for i in range(D):
    p, c = [int(c) for c in input().split(" ")]
    score = 100 * (i + 1)
    scores = Score(score, p, c)
    score_lists.append(scores)

masks = [0] * D
dfs(score_lists, masks, 0, 0, 0)

print(min_times)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import numpy as np
import math
import re

n = input()
n = re.split(" ",n)
D = int(n[0])
G = int(n[1])

p = []
c = []
for i in range(D):
    x = input()
    x = re.split(" ",x)
    x = list(map(int,x))
    p.append(x[0])
    c.append(x[1])
min = 1000000
sum = 0
count = 0
for i in reversed(range(D)):
    for j in range(p[i]):
        sum += 100*(i+1)
        count += 1
        if(sum >= G):
            if count < min:
                min = count
                sum = 0
                count = 0
            break;
    if sum !=0 and sum < G:
        sum += c[i]
        if sum >= G:
            if count < min:
                min = count
            sum = 0
            count = 0
print(min)

Submission status: Wrong Answer

Solution code:
def add(pc, p, G, tmp, now):
    for i in range(len(pc)-1, -1, -1):
        if i == now:
            continue
        for k in range(pc[i][0]):
            p += (i+1) * 100
            tmp += 1
            if p >= G:
                return tmp
        p += pc[i][1]
        if p >= G:
            return tmp
    return 10 ** 9


D, G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
cnt = 10 ** 9
tmp = 0

for i in range(D):
    p = (i+1) * 100 * pc[i][0]
    p += pc[i][1]
    tmp = pc[i][0]
    if p < G:
        tmp = add(pc, p, G, tmp, i)
    cnt = min(cnt, tmp)
cnt = min(cnt, add(pc, 0, G, 0, -1))
print(cnt)

Submission status: Wrong Answer

Solution code:
def add(pc, p, G, tmp, now):
    for i in range(len(pc)-1, -1, -1):
        if i == now:
            continue
        for k in range(pc[i][0]):
            p += (i+1) * 100
            tmp += 1
            if p >= G:
                return tmp
    return 10 ** 9


D, G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
cnt = 10 ** 9
tmp = 0

for i in range(D):
    p = (i+1) * 100 * pc[i][0]
    p += pc[i][1]
    tmp = pc[i][0]
    if p < G:
        tmp = add(pc, p, G, tmp, i)
    cnt = min(cnt, tmp)
cnt = min(cnt, add(pc, 0, G, 0, -1))
print(cnt)

Submission status: Wrong Answer

Solution code:
def add(pc, p, G, tmp, now):
    for i in range(len(pc)-1, -1, -1):
        if i == now:
            continue
        for k in range(pc[i][0]):
            p += (i+1) * 100
            tmp += 1
            if p >= G:
                return tmp
    return 10 ** 9


D, G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
cnt = 10 ** 9
tmp = 0

for i in range(D):
    p = (i+1) * 100 * pc[i][0]
    p += pc[i][1]
    tmp = pc[i][0]
    if p < G:
        tmp = add(pc, p, G, tmp, i)
    cnt = min(cnt, tmp)
print(cnt)

Submission status: Wrong Answer

Solution code:

D,G = map(int,list(input().split()))

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

ans = 10**18
for i in range(2**D):
    binary = bin(i)[2:].zfill(D)
    tatal = 0
    cnt = 0
    for j in range(D):
        if binary[j]=='1':
            tatal += p_tatal[j][1]
            cnt += p_tatal[j][0]
        else:
            not_use = j
#    print(1tatal,cnt)   
    if tatal >= G:
#        print(cnt)
        ans = min(ans,cnt)
    elif tatal < G <=  tatal +(p_tatal[not_use][0]-1)*(not_use+1)*100:
        cnt += (G - tatal)// ((not_use+1)*100)
#        print(cnt)
        ans = min(ans,cnt)
    else:
        continue
        

print(ans)

Submission status: Wrong Answer

Solution code:

D,G = map(int,list(input().split()))

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

ans = 10**18
for i in range(2**D):
    binary = bin(i)[2:].zfill(D)
    tatal = 0
    cnt = 0
    for j in range(D):
        if binary[j]=='1':
            tatal += p_tatal[j][1]
            cnt += p_tatal[j][0]
        else:
            not_use = j
    print(tatal,cnt)   
    if tatal >= G:
#        print(cnt)
        ans = min(ans,cnt)
    elif tatal < G <=  tatal +(p_tatal[not_use][0]-1)*(not_use+1)*100:
        cnt += (G - tatal)// ((not_use+1)*100)
#        print(cnt)
        ans = min(ans,cnt)
    else:
        continue
        

print(ans)

Submission status: Wrong Answer

Solution code:
#人のプログラムの全コピ　TKR18さん

#入力
a,b=map(int,input().split())
c=[0]+[list(map(int,input().split()))for i in range(a)]

print(c)

def f(t,s): #t:t*100点までリストが存在する s: 目標値
    if t==0: #が0の時、とりあえず大きな数を返す
        return 10**9
    l=min(s//(t*100),c[t][0]) #s//(t*100): 目標を最高基本点で割った時の商、c[t][0]:最高基本点の使える数　これらの小さい方を返す
    k=100*t*l #最高基本点を使って得点できる最高点
    if l==c[t][0]: #最高基本点を使った数が、使える数と同じならボーナス点を加える。
        k+=c[t][1] 
    if k<s: #最高基本点を全て使って得点できる点が、目標点以下なら...
        l+=f(t-1,s-k) #最高気本点を除いたもので、残りの点数を計算する。
    return min(l,f(t-1,s)) #最高気本点を使うもの(l)と最高基本点を使わないもの(f(t-1,s)のうち最小のものを見つける
print(f(a,b))

Submission status: Wrong Answer

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

cnt = 10 ** 9

for i, q in enumerate(Q):
	p = (i+1) * 100
	p *= q[0]
	p += q[1]
	if p >= G:
		cnt = min(cnt, q[0])

def calc(D, Q, cnt):
	p, tmp = 0, 0
	for i in range(D-1,-1,-1):
		for k in range(Q[i][0]):
			p += (i+1) * 100
			tmp += 1
			if p >= G:
				cnt = min(cnt, tmp)
				return cnt
		p += Q[i][1]
		if p >= G:
			cnt = min(cnt, tmp)
			return cnt
	return cnt

print(calc(D, Q, cnt))

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
G //= 100
problems = []
for i in range(D):
    b = i + 1
    p, c = map(int, input().split())
    problems.append((b, p, c))  # 基本点, 問題数, ボーナス

nsolved = {0: 0}  # 総合点 → 必要問題数

for b, p, c in problems:
    nsolved2 = {}
    for k in nsolved:
        for n in range(p + 1):
            s = b * n + (0 if n < p else c)  # n問解いたときの総合点
            g = min(k + s, G)                # 総合点
            if g not in nsolved2:
                nsolved2[g] = nsolved[k] + n
            else:
                nsolved2[g] = min(nsolved2[g], nsolved[k] + n)
    nsolved = nsolved2

print(nsolved[G])

Submission status: Wrong Answer

Solution code:
import math
d,g = map(int, input().split())
l = []
ans = 10**5

for i in range(d):
    l.append(list(map(int, input().split())))

for i in range(2 ** d):
    count = 0
    score = 0
    remain = -1
    for j in range(d):
        if (i >> j) & 1: # j: コンプリートしない問題
            count += l[j][0]
            score += l[j][1] + l[j][0] * 100 * (j+1)
        else:
            remain = j
    if score >= g:
        ans = min(ans, count)
    else:# remain: コンプリートしない問題でもっとも点数の高い問題
        s1 = 100 * (remain+1)
        need_n = (g - score) // s1
        if need_n >= l[remain][0]:
            continue
        count += need_n
        ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
import math
d,g = map(int, input().split())
l = []
ans = 10**5

for i in range(d):
    l.append(list(map(int, input().split())))

for i in range(2 ** d):
    count = 0
    score = 0
    remain = -1
    for j in range(d):
        if (i >> j) & 1:
            count += l[j][0]
            score += l[j][1] + l[j][0] * 100 * (j+1)
        else:
            remain = j
    if score < g:
        s1 = 100 * (remain+1)
        need_n = (g - score) // s1
        if need_n >= l[j][0]:
            continue
        count += need_n
    ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
d,g=map(int,input().split())
g//=100
l=[]
ans=1000
for i in range(1,d+1):
  p,c=map(int,input().split())
  c//=100
  l+=[[p,c,i*p,i*p+c]]
for i in range(2**d):
  score=0
  a=0
  b=1
  c=0
  while i:
    if i%2>0:
      score+=l[a][3]
      c+=l[a][0]
    else:
      b=a+1
    a+=1
    i//=2
  if score>=g:
    ans=min(ans,c)
  elif score+l[b-1][2]>=g:
    ans=min(ans,c+(g-score)//b+((g-score)%b>0))
print(ans)

Submission status: Wrong Answer

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


def convert(n):
    Bin = []
    while n != 0:
        a = n % 2
        n //= 2
        Bin.insert(0, a)
    if not Bin:
        Bin.append(0)
    return Bin


Min = 10**8
for i in range(0, 2**D-1):
    Bin = [str(s) for s in convert(i)]
    Bin = ''.join(Bin).zfill(D)
    idx = 0
    ct = 0
    score = 0
    for j in Bin:
        if j == '1':
            p, c = pc[idx]
            ct += p
            score += 100*(idx+1)*p+c
        if score >= G:
            Min = ct if ct < Min else Min
            break
        idx += 1
    if score < G:
        Bin = Bin[::-1]
        idx = 0
        for j in Bin:
            if j == '0':
                p, c = pc[idx]
                for k in range(p-1):
                    ct += 1
                    score += 100*(D-idx)
                    if score >= G:
                        Min = ct if ct < Min else Min
                        break
                score -= 100*(D-idx)*(p-1)
                ct -= (p-1)
            if score >= G:
                break
            idx += 1

print(Min)

Submission status: Wrong Answer

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


def convert(n):
    Bin = []
    while n != 0:
        a = n % 2
        n //= 2
        Bin.insert(0, a)
    if not Bin:
        Bin.append(0)
    return Bin


Min = 10**8
for i in range(0, 2**D-1):
    Bin = [str(s) for s in convert(i)]
    Bin = ''.join(Bin).zfill(D)
    idx = 0
    ct = 0
    score = 0
    for j in Bin:
        if j == '1':
            p, c = pc[idx]
            ct += p
            score += 100*(idx+1)*p+c
        if score >= G:
            Min = ct if ct < Min else Min
            break
        idx += 1
    if score < G:
        Bin = Bin[::-1]
        idx = 0
        for j in Bin:
            if j == '0':
                p, c = pc[idx]
                for k in range(p-1):
                    ct += 1
                    score += 100*(D-idx)
                    if score >= G:
                        Min = ct if ct < Min else Min
                        break
            if score >= G:
                break
            score -= 100*(D-idx)*(p-1)
            ct -= (p-1)
            idx += 1

print(Min)

Submission status: Wrong Answer

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


def convert(n):
    Bin = []
    while n != 0:
        a = n % 2
        n //= 2
        Bin.insert(0, a)
    return Bin


Min = 10**8
for i in range(0, 2**D-1):
    Bin = [str(s) for s in convert(i)]
    Bin = ''.join(Bin).zfill(D)
    idx = 0
    ct = 0
    score = 0
    for j in Bin:
        if j == '1':
            p, c = pc[idx]
            ct += p
            score += 100*(idx+1)*p+c
        if score >= G:
            Min = ct if ct < Min else Min
            break
        idx += 1
    if score < G:
        Bin = Bin[::-1]
        idx = 0
        for j in Bin:
            if j == '0':
                p, c = pc[idx]
                for k in range(p-1):
                    ct += 1
                    score += 100*(D-idx)
                    if score >= G:
                        Min = ct if ct < Min else Min
                        break
            if score >= G:
                break
            score -= 100*(D-idx)*(p-1)
            ct -= (p-1)
            idx += 1

print(Min)

Submission status: Wrong Answer

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


def convert(n):
    Bin = []
    while n != 0:
        a = n % 2
        n //= 2
        Bin.insert(0, a)
    return Bin


Min = 10**8
for i in range(0, 2**D-1):
    Bin = [str(s) for s in convert(i)]
    Bin = ''.join(Bin).zfill(D)
    idx = 0
    ct = 0
    score = 0
    for j in Bin:
        if j == '1':
            p, c = pc[idx]
            ct += p
            score += 100*(idx+1)*p+c
        if score >= G:
            Min = ct if ct < Min else Min
            break
        idx += 1
    if score < G:
        Bin = Bin[::-1]
        idx = 0
        for j in Bin:
            if j == '0':
                p, c = pc[idx]
                for k in range(p-1):
                    ct += 1
                    score += 100*(D-idx)
                    if score >= G:
                        Min = ct if ct < Min else Min
                        break
            if score >= G:
                break
            score -= 100*(D-idx)*(p-1)
            idx += 1

print(Min)

Submission status: Wrong Answer

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

pc = pc[::-1]
flg = 0
score = 0
count = 0
idx = D
for i in pc:
    tmp_score = score
    p, c = i
    tmp_score = 100*p*idx + c
    if tmp_score+score <= G:
        score += tmp_score
        count += p
        flg = 1
    else:
        if flg == 0:
            continue
        break
    idx -= 1

if flg == 0:
    p, c = pc[-1]
    tmp_score = score
    while(score < G):
        score += 100*idx
        count += 1
        if count == p:
            score += c
    print(count)
else:
    pc = pc[D-idx:]

    for i in pc:
        p, c = i
        ct = 0
        while(score < G):
            score += 100*idx
            count += 1
            ct += 1
            if ct == p:
                score += c
                break
        idx -= 1
    print(count)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
comp_points = []
P = []
for i in range(d):
    p, c = map(int, input().split())
    comp_points.append([p, (i + 1) * 100 * p + c])
    P.append(p)

ans = 10**10
#bitallsearch
for i in range(2 ** d):
    bit = format(i, "b").zfill(d)
    count = 0
    point = 0
    for j, dot in enumerate(bit):
        if dot == "1":
            count += comp_points[j][0]
            point += comp_points[j][1]
    #add shortage form high point not comp_points
    for b in range(d-1, 0, -1):
        flag = False
        if point >= g:
            ans = min(ans, count)
            break
        if bit[b] == "0":
            flag = True
            for p in range(P[b] - 1):
                count += 1
                point += (b+1) * 100
                if point >= g:
                    ans = min(ans, count)
                    break
        if (point < g) & flag:
            break

print(ans)

Submission status: Wrong Answer

Solution code:
from math import ceil

D, G = [int(t) for t in input().split()]
p = []
c = []
for i in range(D):
    p_, c_ = [int(t) for t in input().split()]
    p.append(p_)
    c.append(c_)

print(p,c)

def solve(G, i):
    """100i点以下の問題だけでGを達成する最小問題数"""
    if i <= 0:
        return float('inf')
    #最も配転が高い問題で総合点を超えることができるか確認
    n = min(ceil(G / (100 * i)), p[i - 1])
    s = 100 * i * n
    #もし総合展を超えることができるときの問題数がボーナス点に達するならば足す
    if n == p[i - 1]:
        s += c[i - 1]
    if G > s:
        n += solve(G - s, i - 1)
    return min(n, solve(G, i - 1))

print(solve(G, D))

Submission status: Wrong Answer

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

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

arr = []
ans = 1e9
for i in range(2 ** D):
    point = 0
    cnt = 0
    tmp = -1
    for j in range(D):
        if (i >> j) & 1:
            point += PC[j][0] * (j + 1) * 100 + PC[j][1]
            cnt += PC[j][0]

        else:
            tmp = j

    if point >= G:
        ans = min(ans, cnt)
    elif tmp >= 0 and point + PC[tmp][0] * (tmp + 1) * 100 >= G:
        cnt += G - point
        ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

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

prob=[]
for i in range(D):
	p,c=map(int, input().split())
	prob.append({
		"p": p,
		"c": c//100,
		"i": i+1,
		"t": (i+1)*p+c//100,
		"v": i+1+(c//100)/p,
	})

cnt = 0

while G > 0:
	prob = sorted(prob, reverse=True, key=lambda z: z["v"])
	clear = sorted(filter(lambda z: z["t"] >= G, prob), reverse=True, key=lambda z: (z["t"], z["v"]))

	if len(clear) == 0:
		pr = prob.pop(0)
		cnt += pr["p"]
		G -= pr["t"]
	else:
		pr = clear.pop(0)
		cnt += min(G // pr["i"], pr["p"])
		G -= pr["t"]

print(cnt)

Submission status: Wrong Answer

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

prob=[]
for i in range(D):
	p,c=map(int, input().split())
	prob.append({
		"p": p,
		"c": c//100,
		"i": i+1,
		"t": (i+1)*p+c//100,
		"v": i+1+(c//100)/p,
	})

cnt = 0

while G > 0:
	prob = sorted(prob, reverse=True, key=lambda z: z["v"])
	clear = sorted(filter(lambda z: z["t"] >= G, prob), reverse=True, key=lambda z: (z["t"], z["i"]))

	if len(clear) == 0:
		pr = prob.pop(0)
		cnt += pr["p"]
		G -= pr["t"]
	else:
		pr = clear.pop(0)
		cnt += min(G // pr["i"], pr["p"])
		G -= pr["t"]

print(cnt)

Submission status: Wrong Answer

Solution code:
D, G = map(int,input().split())
p,c = {},{}
for i in range(1,D+1):
  pi,ci = map(int,input().split())
  p[i] = pi
  c[i] = ci
ans = sum(p.values())

for i in range(2**D):
  cmp = {i:False for i in range(1,D+1)}
  score = 0
  ans_tmp = 0
  for j in range(D):
    if (i >> j) & 1:
      cmp[j+1] = True
      score += (j+1)*100*p[j+1]+c[j+1]
      ans_tmp += p[j+1]
  keys = [k for k,v in cmp.items() if v == False]
  if 0 < G - score < max(keys)*100*(p[max(keys)]-1):
    ans_tmp += (G-score) // (max(keys)*100) 
    if (G-score) % (max(keys)*100) != 0:
      ans_tmp += 1 
  else:
    ans_tmp = sum(p.values())
        
  ans = min(ans_tmp, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int,input().split())
p,c = {},{}
for i in range(1,D+1):
  pi,ci = map(int,input().split())
  p[i] = pi
  c[i] = ci
ans = sum(p.values())

for i in range(2**D):
  cmp = {i:False for i in range(1,D+1)}
  score = 0
  ans_tmp = 0
  for j in range(D):
    if (i >> j) & 1:
      cmp[j+1] = True
      score += (j+1)*100*p[j+1]+c[j+1]
      ans_tmp += p[j+1]
  if score < G:
    keys = [k for k,v in cmp.items() if v == False]
    ans_tmp += (G-score) // (max(keys)*100) 
    if (G-score) % (max(keys)*100) != 0:
      ans_tmp += 1 
        
  ans = min(ans_tmp, ans)
print(ans)

Submission status: Wrong Answer

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

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

answer = sum(P)
for i in range(2**D):
    point = 0
    x = -1
    now_answer = 0
    for j in range(D):
        if i >> j & 1:
            point += P[j] * (j+1) * 100 + C[j]
            now_answer += P[j]
        else:
            x = j

    if G <= point:
        answer = min(now_answer, answer)
    else:
        n = -(-(G - point)) // ((x+1) * 100)
        if n < P[x]:
            now_answer += n
            answer = min(now_answer, answer)

print(answer)

Submission status: Wrong Answer

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

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

answer = sum(P)
for i in range(2**D):
    point = 0
    x = -1
    now_answer = 0
    for j in range(D):
        if i >> j & 1:
            point += P[j] * (j+1) * 100 + C[j]
            now_answer += P[j]
        else:
            x = j

    if G <= point:
        answer = min(now_answer, answer)
    else:
        n = -(-(G - point)) // ((x+1) * 100)
        if n <= P[x]:
            now_answer += n
            answer = min(now_answer, answer)

print(answer)

Submission status: Wrong Answer

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

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

answer = 10 ** 18
for i in range(2**D):
    point = 0
    x = -1
    now_answer = 0
    for j in range(D):
        if i >> j & 1:
            point += P[j] * (j+1) * 100 + C[j]
            now_answer += P[j]
        else:
            x = j

    if G <= point:
        answer = min(now_answer, answer)
    else:
        n = -(-(G - point)) // ((x+1) * 100)
        if n <= P[x] and x != -1:
            now_answer += n
            answer = min(now_answer, answer)

print(answer)

Submission status: Wrong Answer

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

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

answer = 10 ** 18
for i in range(2**D):
    point = 0
    x = -1
    now_answer = 0
    for j in range(D):
        if i >> j & 1:
            point += P[j] * (j+1) * 100 + C[j]
            now_answer += P[j]
        else:
            x = j

    if G <= point:
        answer = min(now_answer, answer)
    else:
        n = -(-(G - point)) // ((x+1) * 100)
        if n <= P[x]:
            now_answer += n
            answer = min(now_answer, answer)

print(answer)

Submission status: Wrong Answer

Solution code:
import math

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

ans=100000
for i in range(2**D):
    s=bin(i)[2:].zfill(D)
    x=[int(s[i]) for i in range(D)]
    q,score=0,G
    for i in range(D):
        if x[i]==1:
            q+=a[i][0]
            score -= a[i][0]*(i+1)*100 + a[i][1]


    if score>0:
        for i in range(D-1,-1,-1):
            if x[i]==0:
                k=(a[i][0]-1)*(i+1)*100
                if k>=score:
                    q+= math.ceil( score//((i+1)*100) )
                    score=-1
                    break

                else:
                    q+=a[i][0]-1
                    score-= (a[i][0]-1)*(i+1)*100
        
    if score<=0: ans=min(ans,q)


print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

ans=100000
for i in range(2**D):
    s=bin(i)[2:].zfill(D)
    x=[int(s[i]) for i in range(D)]
    q,score=0,G
    for i in range(D):
        if x[i]==1:
            q+=a[i][0]
            score -= a[i][0]*(i+1)*100 + a[i][1]


    if score>0:
        for i in range(D-1,-1,-1):
            if x[i]==0:
                k=(a[i][0]-1)*(i+1)*100
                if k>=score:
                    q+= math.ceil( score//((i+1)*100) )
                    score=-1
                    break
                else:
                    q+=a[i][0]-1
                    score-= (a[i][0]-1)*(i+1)*100
        
    if score<0: ans=min(ans,q)


print(ans)

Submission status: Wrong Answer

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

per_ = [ ((i+1)*100*pc_[i][0]+pc_[i][1])/pc_[i][0] for i in range(D)]

per_ind = sorted([[i,j] for i, j in enumerate(per_)],key = lambda x:x[1],reverse=True)

score = 0
p_num = 0
ind_ = set(list(range(D)))
use_ind = set()

for i,_ in per_ind:
  if score + (i+1)*100*pc_[i][0] + pc_[i][1] < G:
    score += (i+1)*100*pc_[i][0] + pc_[i][1]
    p_num += pc_[i][0]
    use_ind.add(i)
  else:
    div = G-score
    tmp = 0
    min_ = 101
    for j in ind_ - use_ind:
      if (j+1)*100*pc_[j][0] + pc_[j][1] > div:
        if div > (j+1)*100*pc_[j][0]:
          tmp = pc_[j][0]
        else:
          tmp = math.ceil(div/((j+1)*100))
        if min_ > tmp:
          min_ = tmp
    p_num += min_
    break
print(p_num)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import itertools
import collections
import functools
import math
import operator
from queue import Queue
INF = float("inf")


def dfs(curr, goal, count, probs):
    if curr >= goal:
        return count

    if len(probs) == 0:
        return INF

    # ラス一問目を解かない
    m1 = dfs(curr, goal, count, probs[:-1])

    # ラス一問目を解ききる
    m2 = dfs(curr+probs[-1][0] * probs[-1][1] + probs[-1][2],
             goal, count+probs[-1][1], probs[:-1])

    # ラス一問目を途中まで解く
    m3 = INF
    s = goal-curr
    if (probs[-1][0] * probs[-1][1]) > s:
        m3 = count + s // probs[-1][0]

    # print(m1, m2, m3, curr, count, probs)
    return min(m1, m2, m3)


def solve(D: int, G: int, p: "List[int]", c: "List[int]"):

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

    m = dfs(0, G, 0, probs)
    print(m)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    D = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    p = [int()] * (D)  # type: "List[int]"
    c = [int()] * (D)  # type: "List[int]"
    for i in range(D):
        p[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(D, G, p, c)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
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())

ans = float("inf")
def dfs(i, score, question, arr):
    global ans
    if i == d:
        if score >= g:
            ans = min(ans,question)
        else:
            arr.reverse()
            t = arr.index(0)
            t = d - t - 1
            if score + 100 * (t + 1) * p[t] > g:
                if (g - score) % (100 * (t + 1)) == 0:
                    ans = min(ans,question + int((g - score) / (100 * (t + 1))))
                else:
                    ans = min(ans,question + (g -score) // (100 * (t + 1)) + 1)
        return

    arr[i] = 0
    dfs(i + 1, score, question, arr)
    arr[i] = 1
    dfs(i + 1, score + (100 * (i + 1)) * p[i] + c[i], question + p[i], arr)

    return

array = [0] * d
dfs(0,0,0,array)

print(ans)

Submission status: Wrong Answer

Solution code:
from math import ceil

D,G=map(int,input().split())
G=float(G)
p=[]
c=[]
m=10**10
for i in range(D):
    pi,ci=map(int,input().split())
    p.append(pi)
    c.append(ci)
N=bin(2**D)[2:]
for i in range(2**D):
    k=bin(i)[2:].zfill(D)
    num=0
    g=0
    for j in range(D):
        if k[j]=="1":
            num+=p[j]
            g+=p[j]*(j+1)*100+c[j]
        else:
            sub=j
    if G-g<=0:
        m=min(m,num)
        continue
    if int(ceil((G-g)/((sub+1)*100)))>=p[j]:
        continue
    num+=int(ceil((G-g)/((sub+1)*100)))
    m=min(m,num)
print(m)

Submission status: Wrong Answer

Solution code:
from math import ceil

D,G=map(int,input().split())
G=float(G)
p=[]
c=[]
m=10**10
for i in range(D):
    pi,ci=map(int,input().split())
    p.append(pi)
    c.append(ci)
N=bin(2**D)[2:]
for i in range(2**D):
    k=bin(i)[2:].zfill(D)
    num=0
    g=0
    for j in range(D):
        if k[j]=="1":
            num+=p[j]
            g+=p[j]*(j+1)*100+c[j]
        else:
            sub=j
    if G-g<0:
        m=min(m,num)
        continue
    if ceil((G-g)/((sub+1)*100))>=p[j]:
        continue
    num+=int(ceil((G-g)/((sub+1)*100)))
    m=min(m,num)
print(m)

Submission status: Wrong Answer

Solution code:
from math import ceil
 
D,G=map(int,input().split())
G=float(G)
p=[]
c=[]
m=10**10
for i in range(D):
    pi,ci=map(int,input().split())
    p.append(pi)
    c.append(ci)
N=bin(2**D)[2:]
for i in range(2**D):
    k=bin(i)[2:].zfill(D)
    num=0
    g=0
    for j in range(D):
        if k[j]==1:
            num+=p[j]
            g+=p[j]*(j+1)*100+c[j]
        else:
            sub=j
    if G-g<0:
        m=min(m,num)
        continue
    if ceil((G-g)/((sub+1)*100))>=p[j]:
        continue
    num+=int(ceil((G-g)/((sub+1)*100)))
    m=min(m,num)
print(m)