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:
# coding: utf-8
# Your code here!

import copy

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

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


min_num = 1000

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

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

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

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

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

print(min_num)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
ten=[[] for i in range(D+1)]
for i in range(1,D+1):
    p,c=map(int,input().split())
    ten[i]=[j*i*100 for j in range(1,p)]
    ten[i].append(p*i*100+c)
#print(ten)
ans=float("INF")
for i in range(1,1<<(D+1)):

    g=G
    num=0
    for j in range(D,0,-1):
        flg=False
        if 1 and i>>j:
            for k in range(len(ten[j])):
                #print(i,j,k,ten[j][k],ans,num,g)
                if ten[j][k]>=g:
                    num+=k+1
                    flg=True
                    break
                if flg==False and k==len(ten[j])-1:
                    g-=ten[j][-1]
                    num+=len(ten[j])
            else:
                continue
            break
    if flg:
        #print(ans,num)
        ans=min(ans,num)
    #print("ans=",ans)
print(ans)

Submission status: Wrong Answer

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

tmp = 0
ans = 0
for i in range(D-1,-1,-1):
    p,c = table[i]
    tmp += 100*(i+1)*p+c
    ans += p
    if tmp - G >= 100*(i+1)+c:
        tmp -= 100*(i+1)+c
        ans -= 1
        while tmp > G:
            tmp -= 100*(i+1)
            ans -= 1
        break
    elif 100*(i+1)+c>tmp - G>=0:
        break
    else:
        pass
print(ans)

Submission status: Wrong Answer

Solution code:
import math

D, G = [int(x) for x in input().split()]
P = [[int(x) for x in input().split()] for i in range(D)]

min_ = 1e+8
for bit in range(2**D):
  score = 0
  n_solved = 0
  for i in range(D):
    if bit & (1 << i): 
      score += (i + 1) * 100 * P[i][0] + P[i][1]
      n_solved += P[i][0]
  if G < score:
    min_ = min(min_, n_solved)
    continue
  for i in range(D):
    if bin(bit >> i)[-1] == '0':
      need_more = math.ceil((G - score) / ((i+1) * 100))
      need_score = score + need_more * P[i][1]
      if need_more <= P[i][0] - 1 and score < need_score:
        min_ = min(min_, n_solved + need_more)
print(min_)

Submission status: Wrong Answer

Solution code:
def dfs(i, total, S, remain):
    global ans
    if i == D:
        if S < G:
           use = max(remain)
           N = min(L[use-1][0], (G-S)//(100*use))
           S += 100 * N * use
           total += N
           
        if S >= G:
           ans = min(ans, total)
    else:
        dfs(i+1, total, S, remain)
        dfs(i+1, total + L[i][0], S + 100 * (i+1) * L[i][0] + L[i][1], remain - {i+1})
 
D, G = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(D)]
ans = 10 ** 9
 
dfs(0, 0, 0, set(range(1, D+1)))
 
print(ans)

Submission status: Wrong Answer

Solution code:
def dfs(i, total, S, remain):
    global ans
    if i == D:
        if S < G:
           use = max(remain)
           N = min(L[use-1][0], (G-S)//(100*L[use-1][0]))
           S += 100 * N * use
           total += N
           
        if S >= G:
           ans = min(ans, total)
    else:
        dfs(i+1, total, S, remain)
        dfs(i+1, total + L[i][0], S + 100 * (i+1) * L[i][0] + L[i][1], remain - {i+1})

D, G = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(D)]
ans = 10 ** 9

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

print(ans)

Submission status: Wrong Answer

Solution code:
import math
import copy
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
aveP = [[(100*(i+1)*pc[i][0]+pc[i][1])/pc[i][0], i, pc[i][0], (100*(i+1)*pc[i][0]+pc[i][1])] for i in range(D)]
aveP2 = aveP
ans = 0
for i in range(D):
    if G <= 100*(i+1)*pc[i][0]:
        aveP2[i][0] = 100*(i+1)
aveP2.sort()
aveP3 = copy.deepcopy(aveP2)
for i in range(D):
    c = aveP3[i][1]
    aveP3[i][1] = aveP3[i][0]
    aveP3[i][0] = c
aveP3.sort()
p = 0
for i in range(1,D+1):
    for l in range(1,len(aveP3)+1):
        if G <= 100 * (aveP3[-l][0] + 1) * aveP3[-l][2] and aveP2[-i][2] > math.ceil(G / (100 * (aveP3[-l][0] + 1))) :
            ans += math.ceil(G / (100 * (aveP3[-l][0] + 1)))
            p = 1
            break
    if p == 1:
        break
    G -= aveP2[-i][3]
    ans += aveP2[-i][2]
    for l in range(len(aveP3)):
        if aveP3[l][0] == aveP2[-i][1] and aveP3[l][1] == aveP2[-i][0] and aveP3[l][2] == aveP2[-i][2] and aveP3[l][3] == aveP2[-i][3]:
            del aveP3[l]
            break
    if G <= 0:
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import math
import copy
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
aveP = [[(100*(i+1)*pc[i][0]+pc[i][1])/pc[i][0], i, pc[i][0], (100*(i+1)*pc[i][0]+pc[i][1])] for i in range(D)]
aveP2 = aveP
ans = 0
for i in range(D):
    if G <= 100*(i+1)*pc[i][0]:
        aveP2[i][0] = 100*(i+1)
aveP2.sort()
aveP3 = copy.deepcopy(aveP2)
for i in range(D):
    c = aveP3[i][1]
    aveP3[i][1] = aveP3[i][0]
    aveP3[i][0] = c
aveP3.sort()
p = 0
for i in range(1,D+1):
    for l in range(1,len(aveP3)+1):
        if G <= 100 * (aveP3[-l][0] + 1) * aveP3[-l][2] and aveP2[-i][2] > math.ceil(G / (100 * (aveP3[-l][0] + 1))) :
            ans += math.ceil(G / (100 * (aveP3[-l][0] + 1)))
            p = 1
            break
    if p == 1:
        break
    G -= aveP2[-i][3]
    ans += aveP2[-i][2]
    for l in range(len(aveP3)):
        if aveP3[l][0] == aveP2[-i][1] and aveP3[l][1] == aveP2[-i][0] and aveP3[l][2] == aveP2[-i][2] and aveP3[l][3] == aveP2[-i][3]:
            del aveP3[l]
            break

    if G <= 0:
        break
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(float, input().split())
    
ans = 0

    
for i in range(2**d):
    score = 0
    count = 0
    for j in range(d):
        if (i >> j) & 1:
            score += p[j]*100*(j+1) + c[j]
            count += p[j]
            
    if g > score:
        for k in range(d-1,-1,-1):
            if (i >> k) & 1 == 0 :
                if (g - score) <= p[k]*100*(k+1):
                    count += (g - score)//((k+1)*100)
                    break
                else:
                    count = 1145141919
                    break
                    
    if ans == 0 or count<ans:
        ans = count

print(int(ans))

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
pc = []
for i in range(D):
    p,c = map(int,input().split())
    pc.append([i+1,p,c])
pc.sort(reverse = True)
ansc = []
for i in range(2**D):
    count = 0
    sumb = 0
    pc2 = []
    for j in range(D):
        if (i >> j) & 1 == 1:
            sumb += 100*pc[j][0]*pc[j][1] + pc[j][2]
            count += pc[j][1]
        else:
            pc2.append(pc[j])
    pc2 = sorted(pc2,reverse = True)
    c2 = 0
    if sumb < G:
        c2 = (G - sumb)//(100*pc2[0][0])
        if c2 >= pc2[0][1]:
            count = 10**9
        else:
            count += c2
    ansc.append(count)
print(min(ansc))

Submission status: Wrong Answer

Solution code:
import math
d, g = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(d)]
for i in range(d):
    lst[i].append((i+1) * 100)
    lst[i].append((i+1) * 100 + lst[i][1] / lst[i][0])
    lst[i].append((i+1) * 100 * lst[i][0] + lst[i][1])
lst.sort(key=lambda x: x[3], reverse=True)
#print(lst)

min_count = 10 ** 9 + 7
for last in range(d):
    now = 0
    count = 0
    for i in range(d):
        if i != last:
            if now + lst[i][4] <= g and lst[i][3] >= lst[last][3]:
                now += lst[i][4]
                count += lst[i][0]
            elif now + lst[i][4] <= g and math.ceil((g - now) / lst[last][2]) >= lst[last][0]:
                now += lst[i][4]
                count += lst[i][0]
            else:
                break
    #print(now)
    add = math.ceil((g - now) / lst[last][2])
    if g - now <= lst[last][4]:
        add = min(add, lst[last][0])
        min_count = min(min_count, count+add)

    #print(add)
    #if add < lst[last][0]:
     #   min_count = min(min_count, count+add)
    #print(min_count)

print(min_count)

Submission status: Wrong Answer

Solution code:
import math
d, g = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(d)]
for i in range(d):
    lst[i].append((i+1) * 100)
    lst[i].append((i+1) * 100 + lst[i][1] / lst[i][0])
    lst[i].append((i+1) * 100 * lst[i][0] + lst[i][1])
lst.sort(key=lambda x: x[3], reverse=True)
#print(lst)

min_count = 10 ** 9 + 7
for last in range(d):
    now = 0
    now2 = 0
    count = 0
    count2 = 0
    for i in range(d):
        if i != last:
            if now + lst[i][4] <= g and lst[i][3] >= lst[last][3]:
                now += lst[i][4]
                count += lst[i][0]
                now2 += lst[i][4]
                count2 += lst[i][0]
            elif now + lst[i][4] <= g and math.ceil((g - now) / lst[last][2]) >= lst[last][0]:
                now += lst[i][4]
                count += lst[i][0]
                now2 += lst[i][4]
                count2 += lst[i][0]
            elif now < g:
                now2 += lst[i][4]
                count2 += lst[i][0]
            else:
                break
    #print(now)
    add = math.ceil((g - now) / lst[last][2])
    #print(add)
    if add < lst[last][0]:
        min_count = min(min_count, count+add)
    if now2 >= g:
        min_count = min(min_count, count2)
    #print(min_count)

print(min_count)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
lst = []
for _ in range(d):
  lst.append([int(i) for i in input().split()])

res = 1000
for i in range(1 << d):
  s = 0
  c = 0
  for j in range(d):
    if i >> j & 1:
      s += 100 * (j + 1) * lst[j][0] + lst[j][1]
      c += lst[j][0]
    else:
      last = j
    if s < g:
      s100 = 100 * (j + 1)
      need = (g - s - 1) // s100 + 1
      if need > lst[j][0]:
        continue
      c += need
    if res > c:
      res = c
print(res)

Submission status: Wrong Answer

Solution code:
D,G = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(D)]
ans = 0
 
for i in range(2**D):
	point = 0
	count = 0
	for j in range(D):
		if (i>>j)&1:
			point += 100*(j+1)*X[j][0]+X[j][1]
			count += X[j][0]
	if 	G > point:
		for k in range(D)[::-1]:
			if (i>>k)&1==0:
				if (G-point) <= 100*(k+1)*(X[k][0]-1):
					count +=  ((G-point) // (100*(k+1)))
					break
				else:
					count = 10**5
					break
	if ans == 0 or count < ans:
		ans = count
 
print(ans)

Submission status: Wrong Answer

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

for i in range(2**D):
	point = 0
	count = 0
	for j in range(D):
		if (i>>j)&1:
			point += 100*(j+1)*X[j][0]+X[j][1]
			count += X[j][0]
	if 	G > point:
		for k in range(D)[::-1]:
			if (i>>k)&1==0:
				if (G-point) <= 100*(k+1)*(X[k][0]-1):
					count += (G-point) // (100*(k+1))
					break
				else:
					count = 10**5
					break
	if ans == 0 or count < ans:
		ans = count

print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int, input().split())
a = [ list(map(int,input().split())) for i in range(d)]
p = []
c = []
start=0
end=0
mini = 1000

for i in range(len(a)):
  p.extend([100 * (i+1)] * a[i][0])
  c.append(a[i][1])
cnt=0
for i in range(2 ** len(p)):
  bit = []
  cnt+=1
  for j in range(len(p)):
    if (i>>j) & 1:
      bit.append(1)
    else:
      bit.append(0)
   
  Sum = 0
  for k in range(len(c)):
    start = 0 
    end += a[k][0]
    if (sum(bit[start:end])) == a[k][0]:
      Sum+=c[0]
    start+=end
  
  for k in range(len(p)):
    if bit[k] == 1:
      Sum+=p[k]
  if Sum>=g:
    mini = min(mini,sum(bit))
print(mini)

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())

ans = 1e9
for mask in range(1 << D):
  s, num, rest_max = 0, 0, -1
  # print("mask", mask)
  for i in range(D):
    # print("i", i)
    if mask >> i & 1:
      # print(bin(mask))
      s += 100 * (i+1) * p[i] + c[i]
      num += p[i] # 問題数
    else:
      rest_max = i # 完全に解いた問題以外のうち最大点数の問題

  if s < G: # Gに満たない
    s1 = 100 * (rest_max + 1)
    need = (G - s) // s1     
    if need >= p[rest_max]:
      # print("short!", need, p[rest_max])
      continue # 完全に解く＋中途半端に解くがG点に満たない
    num += need
  
  # print("mask",mask,num,s)
  ans = min(ans, num)
    
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())

ans = 1e9
for mask in range(1 << D):
  s, num, rest_max = 0, 0, -1
  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: # Gに満たない
    s1 = 100 * (rest_max + 1)
    need = (G - s) // s1     
    if need >= p[rest_max]:
      continue # 完全に解く＋中途半端に解くがG点に満たない
    num += need
  
  ans = min(ans, num)
    
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

def main():
    sum=0
    ans=0
    ansc=0
    D,G = map(int,input().split())

    lis=[]
    for x in range(D):
        P,C = map(int,input().split())
        lis.append([P,C])

    op_cnt = D

    for i in range(2 ** op_cnt):
        for j in range(op_cnt):
            if((i>>j) & 1 and i!=0):
                for k in range(1, lis[j][0]+1):
                    sum+=(100*(j+1))
                    ansc+=1
                    if(k==lis[j][0]):
                        sum+=lis[j][1]
                    if(sum>=G):
                        break

        if(sum<G):
            for lef in reversed(range(0, op_cnt)):
                if(~(i>>lef) & 1 and lis[lef][0] != 1):
                    for l in range(1,lis[lef][0]+1):
                        sum+=(100*(lef+1))
                        ansc+=1
                        if(sum>=G):
                            break

        if(ans>=ansc or ans==0):
            ans=ansc

        ansc=0
        sum=0

    print(ans)
main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    sum=0
    ans=0
    ansc=0
    D,G = map(int,input().split())

    lis=[]
    for x in range(D):
        P,C = map(int,input().split())
        lis.append([P,C])

    op_cnt = D

    for i in range(2 ** op_cnt):
        for j in range(op_cnt):
            if((i>>j) & 1 and i!=0):
                for k in range(1, lis[j][0]+1):
                    sum+=(100*(j+1))
                    ansc+=1
                    if(k==lis[j][0]):
                        sum+=lis[j][1]
                    if(sum>=G):
                        break

        print(ansc,bin(i))
        if(sum<G):
            for lef in reversed(range(0, op_cnt)):
                if(~(i>>lef) & 1 and lis[lef][0] != 1):
                    for l in range(1,lis[lef][0]+1):
                        sum+=(100*(lef+1))
                        ansc+=1
                        if(sum>=G):
                            break

        if(ans>=ansc or ans==0):
            ans=ansc

        ansc=0
        sum=0

    print(ans)
main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    sum=0
    ans=0
    ansc=0
    D,G = map(int,input().split())

    lis=[]
    for x in range(D):
        P,C = map(int,input().split())
        lis.append([P,C])

    op_cnt = D

    for i in range(2 ** op_cnt):
        for j in range(op_cnt):
            if((i>>j) & 1 and i!=0):
                for k in range(1, lis[j][0]+1):
                    sum+=(100*(j+1))
                    ansc+=1
                    if(k==lis[j][0]):
                        sum+=lis[j][1]
                    if(sum>=G):
                        break
        if(sum<G):
            for lef in reversed(range(0, op_cnt)):
                if(~(i>>lef) & 1 and lis[lef][0] != 1):
                    for l in range(1,lis[lef][0]+1):
                        sum+=(100*(lef+1))
                        ansc+=1
                        if(sum>=G):
                            if(ans>=ansc or ans==0):
                                ans=ansc
                            break




        ansc=0
        sum=0

    print(ans)
main()

Submission status: Wrong Answer

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

p = []  # 各点数台の問題数のリスト
c = []  # 各点数台のコンプリートボーナス

# 各点数台を、完全に解くかどうかのリスト　1問も解かないとして初期化
solve_completely_list = [False] * D

# 入力処理
for d in range(D):
    p_i, c_i = map(int, input().split())
    p.append(p_i)
    c.append(c_i)


def dfs(i, solve_completely_list, completed_amount_list):
    if i >= D:
        is_larger_than_G = False    # フラグ初期化
        # total_score計算
        total_score = 0
        completed_amount = 0
        for d in range(D):
            if solve_completely_list[d]:
                total_score += (d+1) * 100 * p[d] + c[d]
                completed_amount += p[d]


        # total_scoreがGより小さいとき
        # Gより大きくなるまで、一番大きい配点を足す
        # 一番大きい配点をp-1個足してもGより小さい場合、諦めて他の枝に移る
        if total_score < G:
            # solve_completely_list[D]がTrueのときは、(D-1) * 100を最大の配点とする
            # solve_completely_list[i]がFalseであるiのうち最大のiの配点を使う
            max_d = -1
            for i in reversed(range(D)):
                if solve_completely_list[i] == False:
                    max_d = i
                    break
            # 多分ありえないけど一応
            if max_d == -1:
                return

            for p_d in range(p[max_d - 1] - 1):
                total_score += max_d * 100
                completed_amount += 1
                if total_score >= G:
                    is_larger_than_G = True
                    break
        else:
            is_larger_than_G = True
        
        if is_larger_than_G:
            completed_amount_list.append(completed_amount)
        return
    

    # 完全に解く(100i 点の問題を pi 問解く)場合
    solve_completely_list[i] = True
    dfs(i + 1, solve_completely_list, completed_amount_list)

    # 1問も解かない場合
    solve_completely_list[i] = False
    dfs(i + 1, solve_completely_list, completed_amount_list)

completed_amount_list = []    # 回答した数のリスト
dfs(0, solve_completely_list, completed_amount_list)
print(min(completed_amount_list))

Submission status: Wrong Answer

Solution code:
import sys

def main():
    sum=0
    ansc=0
    D,G = map(int,input().split())

    lis=[]
import sys

def main():
    sum=0
    ansc=0
    D,G = map(int,input().split())

    lis=[]
    for x in range(D):
        P,C = map(int,input().split())
        lis.append([P,C])

    op_cnt = D

    for i in range(2 ** op_cnt):
        for j in range(op_cnt):
            if((i>>j) & 1 and i!=0):
                for k in range(1, lis[j][0]+1):
                    sum+=(100*(j+1))
                    ansc+=1
                    if(sum>=G):
                        break
                    if(k==lis[j][0]):
                        sum+=lis[j][1]
            if(sum<G):
                for lef in reversed(range(0, op_cnt-1)):
                    if((i>>lef) & 0):
                        for l in range(1,lis[lef][0]):
                            sum+=(100*(l+1))
                            ansc+=1


        print(sum,bin(i),ansc)


        ansc=0
        sum=0

main()

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p = [[i*100] + list(map(int, input().split()))
     for i in range(1, d+1)]
p = list(map(lambda x: x + [x[0] * x[1] + x[2]], p))

res = 1001
for bit in range(d**2):
    score = 0
    cnt = 0
    zero = 0
    for i in range(d):
        if bit & (1 << i):
            score += p[i][3]
            cnt += p[i][1]
        else:
            zero = i
    if score >= g:
        res = min(res, cnt)
    else:
        remaining = (g - score + p[zero][0]-1) // p[zero][0]
        if remaining < p[zero][1]:
            res = min(res, cnt+remaining)

print(res)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc104/tasks/abc104_c

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

p = []  # 各点数台の問題数のリスト
c = []  # 各点数台のコンプリートボーナス

# 各点数台を、完全に解くかどうかのリスト　1問も解かないとして初期化
solve_completely_list = [False] * D

# 入力処理
for d in range(D):
    p_i, c_i = map(int, input().split())
    p.append(p_i)
    c.append(c_i)


def dfs(i, solve_completely_list, completed_amount_list):
    if i >= D:
        is_larger_than_G = False    # フラグ初期化
        # total_score計算
        total_score = 0
        completed_amount = 0
        for d in range(D):
            if solve_completely_list[d]:
                total_score += (d+1) * 100 * p[d] + c[d]
                completed_amount += p[d]


        # total_scoreがGより小さいとき
        # Gより大きくなるまで、一番大きい配点を足す
        # 一番大きい配点をp-1個足してもGより小さい場合、諦めて他の枝に移る
        if total_score < G:
            # solve_completely_list[D]がTrueのときは、(D-1) * 100を最大の配点とする
            if solve_completely_list[D-1]:
                max_d = D-1
            else:
                max_d = D

            for p_d in range(p[max_d - 1] - 1):
                total_score += max_d * 100
                completed_amount += 1
                if total_score >= G:
                    is_larger_than_G = True
                    break
        else:
            is_larger_than_G = True
        
        if is_larger_than_G:
            completed_amount_list.append(completed_amount)
        return
    

    # 完全に解く(100i 点の問題を pi 問解く)場合
    solve_completely_list[i] = True
    dfs(i + 1, solve_completely_list, completed_amount_list)

    # 1問も解かない場合
    solve_completely_list[i] = False
    dfs(i + 1, solve_completely_list, completed_amount_list)

completed_amount_list = []    # 回答した数のリスト
dfs(0, solve_completely_list, completed_amount_list)
print(min(completed_amount_list))

Submission status: Wrong Answer

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

p = []  # 各点数台の問題数のリスト
c = []  # 各点数台のコンプリートボーナス

# 各点数台を、完全に解くかどうかのリスト　1問も解かないとして初期化
solve_completely_list = [False] * D

# 入力処理
for d in range(D):
    p_i, c_i = map(int, input().split())
    p.append(p_i)
    c.append(c_i)


def dfs(i, solve_completely_list, completed_amount_list):
    if i >= D:
        is_larger_than_G = False    # フラグ初期化
        # total_score計算
        total_score = 0
        completed_amount = 0
        for d in range(D):
            if solve_completely_list[d]:
                total_score += (d+1) * 100 * p[d] + c[d]
                completed_amount = p[d]


        # total_scoreがGより小さいとき
        # Gより大きくなるまで、一番大きい配点を足す
        # 一番大きい配点をp-1個足してもGより小さい場合、諦めて他の枝に移る
        if total_score < G:
            # solve_completely_list[D]がTrueのときは、(D-1) * 100を最大の配点とする
            if solve_completely_list[D-1]:
                max_d = D-1
            else:
                max_d = D

            for p_d in range(p[max_d - 1] - 1):
                total_score += max_d * 100
                completed_amount += 1
                if total_score >= G:
                    is_larger_than_G = True
                    break
        else:
            is_larger_than_G = True
        
        if is_larger_than_G:
            completed_amount_list.append(completed_amount)
        return
    

    # 完全に解く(100i 点の問題を pi 問解く)場合
    solve_completely_list[i] = True
    dfs(i + 1, solve_completely_list, completed_amount_list)

    # 1問も解かない場合
    solve_completely_list[i] = False
    dfs(i + 1, solve_completely_list, completed_amount_list)

completed_amount_list = []    # 回答した数のリスト
dfs(0, solve_completely_list, completed_amount_list)
print(min(completed_amount_list))

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
p = [[i*100] + list(map(int, input().split()))
     for i in range(1, d+1)]
p = list(map(lambda x: x + [x[0] * x[1] + x[2]], p))

res = 1001
for bit in range(d**2):
    score = 0
    cnt = 0
    for i in range(d):
        if bit & (1 << i):
            score += p[i][3]
            cnt += p[i][1]
    if score >= g:
        res = min(res, cnt)
    else:
        for i in range(d):
            if not (bit & (1 << i)):
                remaining = (g - score + p[i][0]-1) // p[i][0]
                if remaining < p[i][1]:
                    res = min(res, cnt+remaining)

print(res)

Submission status: Wrong Answer

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

# 十分大きい数を用意する
ans = float("inf")

# それぞれのランクの問題を「完全に解く」 or not -> 2^D通り
for bit in range(1 << D):
    score = 0
    solve = 0
    rest = set(range(1, D + 1))

    for i in range(D):
        # (i+1)番目の問題を完全に解いた場合
        if (bit>>i) & 1:
            # スコア = 基本スコア + コンプリートボーナス
            score += PC[i][0] * (i + 1) * 100 + PC[i][1]
            solve += PC[i][0]
            # 今回解いたランクの問題を削除
            rest.discard(i + 1)

    # 目標点に満たない場合、restの大きいものから順に解く
    if score < G:
        target = max(rest)
        n = min(PC[target - 1][0], (G-score) // (target*100))
        score += n * target * 100
        solve += n

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

print(ans)

Submission status: Wrong Answer

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

comp_bounas_list = [[int(item) for item in input().split()] for _ in range(D)]



comp_prob_list = []

for i in range(2**D):
    comp_prob = []
    total_prob_n = 0
    total_point = 0
    for j in range(D):
        if ((i >> j) & 1 == 1):
            comp_prob.append([comp_bounas_list[j][0], comp_bounas_list[j][0]*(j+1)*100 + comp_bounas_list[j][1]])
            total_prob_n += comp_bounas_list[j][0]
            total_point += comp_bounas_list[j][0]*(j+1)*100 + comp_bounas_list[j][1]
        else:
            comp_prob.append([0, 0])


    comp_prob_list.append([total_prob_n, total_point])

# print(comp_prob_list)

candi = [ item[0] for item in comp_prob_list if item[1] >= G]
print(min(candi))

Submission status: Wrong Answer

Solution code:
import sys
D,G=map(int,input().split())
Dat=[]
for i in range(1,D+1):
  pi,ci=map(int,input().split())
  Dat.append([i,pi,ci])
GT = 0
Cnt = 0
for i in range(D,0,-1):
  for j in range(1,Dat[i-1][1]):
    Cnt += 1
    GT += 100*i
#    print(Cnt,GT)
    if GT>= G:
      print(Cnt)
      sys.exit()
  Cnt += 1
  GT += 100*i +Dat[i-1][2]
  if GT>= G:
    print(Cnt)
    sys.exit()

Submission status: Wrong Answer

Solution code:
D,G = map( int,input().split() )
PC = [ list(map(int,input().split())) for i in range(D) ]
ans = 10**7

for i in range(D):
  score=0
  l=0
  for j in range(PC[i][0]-1):
    score += 100*(i+1)
    l += 1
    if score>=G and ans>l:
      ans=l

for i in range(1,2**D):
  score = 0
  l = 0
  k = -1
  for j,flag in enumerate( list(format(i,"b"))[::-1] ):
    if flag=="1":
      score += PC[j][0]*100*(j+1)  + PC[j][1]
      l += PC[j][0]
    else:
      k=j
  if score<G:
    j=0
    while score<G or j<k:
      score+=100*(j+1)
      l+=1
      j+=1
  if ans>l:
    ans=l
            
print(ans)