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:
#!/usr/bin/env python3
import sys


def solve(D: int, G: int, p: "List[int]", c: "List[int]"):
    ans = 1e9
    for bit in range(2 ** D):
        sum = 0
        rest_max = -1
        num = 0

        for i in range(D):
            if bit & 1 << i:
                sum += (i + 1) * 100 * p[i] + c[i]
                num += p[i]
            else:
                rest_max = i
        
        if sum < G:
            remain = G - sum
            need = int(remain / (100 * (rest_max + 1)))
            if need >= p[rest_max]:
                continue
            num += need
        ans = min(ans, num)

    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
d, g = map(int, input().split())
src = [list(map(int, input().split())) for _ in range(d)]

ans = 10**10
for b in range(2**d):
  score = 0
  ac = 0
  for k in range(d):
    if b&(1<<k):
      p,c = src[k]
      score += c
      ac += p
      score += p*(k+1)*100
  if score >= g:
    ans = min(ans, ac)
    continue
  for k in range(d-1, -1, -1):
    if b&(1<<k)==0:
      p, c = src[k]
      if score +p*(k+1)*100 < g:
        score += p*(k+1)*100
        print('!')
        ac += p
      else:
        rem = g-score
        ac += -(-rem // (k+1) // 100)
        ans = min(ans, ac)
        break
print(ans)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
D, G = MAP()
pc = [LIST() for _ in range(D)]

count_min = 1001

for i in range(1<<D):
	count = 0
	sum = 0
	i = list("{:b}".format(i).zfill(D))
	#print(i)
	for j in range(D):
		if i[j] == "1":
			count += pc[j][0]
			sum += pc[j][0]*100*(j+1) + pc[j][1]

	if sum >= G:
		if count < count_min:
			#print("更新", count_min, ">", count)
			count_min = count

	else:
		for j in range(D-1, -1, -1):
			if i[j] == "0":
				remain_count = ceil((G-sum)//(100*(j+1)))
				#print(remain_count)
				if remain_count >= pc[j][0]:
					count = 1001
					break
				else:
					count += remain_count

				if count < count_min:
					#print("更新", count_min, ">", count)
					count_min = count

print(count_min)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
D, G = MAP()
pc = [LIST() for _ in range(D)]

count_min = 1001

for i in range(1<<D):
	count = 0
	sum = 0
	i = list("{:b}".format(i).zfill(D))
	#print(i)
	for j in range(D):
		if i[j] == "1":
			count += pc[j][0]
			sum += pc[j][0]*100*(j+1) + pc[j][1]

	if sum >= G:
		if count < count_min:
			#print("更新", count_min, ">", count)
			count_min = count

	else:
		for j in range(D-1, -1, -1):
			if i[j] == "0":
				remain_count = ceil((G-sum)//(100*(j+1)))
				#print(remain_count)
				if remain_count >= pc[j][0]:
					count = 1001
				else:
					count += remain_count

				if count < count_min:
					#print("更新", count_min, ">", count)
					count_min = count

print(count_min)

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import combinations_with_replacement
    from math import ceil

    d, g, *pc = map(int, open(0).read().split())
    p, c = pc[::2], pc[1::2]

    q = ceil(g / (d * 100))
    if q < p[-1]:
        print(int(q))
        exit()
        
    ans = sum(p)
    l = range(d)
    for x in combinations_with_replacement(l, d):
        y = list(set(x))
        tmp = g
        count = 0
        for i in y:
            tmp -= ((i + 1) * 100 * p[i] + c[i])
            count += p[i]
        if tmp <= 0:
            ans = min(ans, count)
        else:
            j = max(set(l) - set(x))
            k = ceil(tmp / (100 * (j + 1)))
            if k < p[j]:
                count += k
                ans = min(ans, count)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import itertools
from pprint import pprint
import sys 
sys.setrecursionlimit(1000000000)
#基本的に10*100*len(bonus_masterlist)回ループを回せばよい
#len(bonus_masterlist)は最大で2**10=1024
#余裕をもってさらに100倍

d,g = map(int,input().split())

plist=[]
clist=[]

bonus_masterlist=[]

for _ in range(d):
    p_temp,c_temp = map(int,input().split())
    plist.append(p_temp)
    clist.append(c_temp)


bonus_masterlist = list(itertools.product(range(2), repeat=d))
#bit全探索をやらなくても、itertoolsを使えば一瞬でできちゃう。(タプルのリスト)
#for i in range(2**d):
#    bonus_templist = [0] * d
#    for j in range(d):
#        if i >> j & 1:
#            bonus_templist[d-1-j] = 1
#    bonus_masterlist.append(bonus_templist)

#point_list = [100,200,300, ... ,d*100]
#max_list: plist = [p[0],p[1],p[2], ... ,p[d]]
#bonuspoint_list: clist = [c[0],c[1],c[2], ... ,c[d]]

count_list = [0] * d

mincount = 100 * 10

def dfs(target):
    global mincount
    if sum([count_list[i] * 100*(i+1) for i in range(d)]) + sum([bonus_list[j] * clist[j] for j in range(d)]) >= g:
        if sum(count_list) < mincount:
            mincount = sum(count_list)
        return
    elif plist[target] == count_list[target]:
        bonus_list[target] = 1
        dfs(target-1)
    elif plist[target] > count_list[target]:
        count_list[target] += 1
        dfs(target)

for bonus_tuple in bonus_masterlist:
    bonus_list = list(bonus_tuple)
    count_list = [x * y for (x, y) in zip(bonus_list, plist)]
    pprint(bonus_list)
    pprint(clist)
    dfs(d-1)

print(mincount)

Submission status: Wrong Answer

Solution code:
import itertools
n, g = map(int, input().split())
L = []
for i in range(n):
    t = list(map(int, input().split()))
    # 得点の情報を追加
    t.append((i+1)*100)
    # この配点の問題を全部解いた時の得点
    t.append((i+1)*100*t[0]+t[1])
    L.append(t)
print(L)
# https://img.atcoder.jp/abc104/editorial.pdf bit全探索


# 全探索したら時間超過
# ans = 100 * n
# for v in itertools.permutations(L):
#     score = 0
#     count = 0
#     k = 0
#     p = v[k][0]
#     while score < g:
#         score += v[k][2]
#         p -= 1
#         count += 1
#         if p == 0:
#             score += v[k][1]
#             k += 1
#             if k < n:
#                 p = v[k][0]
#     ans = min(ans, count)
# print(ans)

# DPっぽく解こうとしたけど失敗
# P = []
# G = []
# for i in range(n):
#     s, t = map(int, input().split())
#     P.insert(0, s)
#     G.insert(0, t//100)
# score = 0
# k = 0
# count = 0
# while score < g:
#     count += 1
#     if 1 in P:
#         j = P.index(1)
#         score += n-j + G[j]
#         P[j] = 0
#         if j == k:
#             k += 1
#     else:
#         score += n-k
#         P[k] -= 1
#     print(P,G,score,count,k)
# print(count)

Submission status: Wrong Answer

Solution code:
import itertools
n, g = map(int, input().split())
L = []
for i in range(n):
    t = list(map(int, input().split()))
    # 得点の情報を追加
    t.append((i+1)*100)
    L.append(t)
print(n, g, L)

ans = 100 * n
for v in itertools.permutations(L):
    print(v)
    score = 0
    count = 0
    k = 0
    p = v[k][0]
    while score < g:
        score += v[k][2]
        p -= 1 # v[k][0] -= 1
        count += 1
        if p == 0: # v[k][0] == 0:
            score += v[k][1]
            k += 1
            if k < n:
                p = v[k][0]
        print(v,count,score,k,p)
    ans = min(ans, count)
print(ans)

# ミス
# P = []
# G = []
# for i in range(n):
#     s, t = map(int, input().split())
#     P.insert(0, s)
#     G.insert(0, t//100)
# score = 0
# k = 0
# count = 0
# while score < g:
#     count += 1
#     if 1 in P:
#         j = P.index(1)
#         score += n-j + G[j]
#         P[j] = 0
#         if j == k:
#             k += 1
#     else:
#         score += n-k
#         P[k] -= 1
#     print(P,G,score,count,k)
# print(count)

Submission status: Wrong Answer

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

p = []
c = []

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

minp = sum(p)

def min_plobrem(p,c):
    res = []
    if len(p) == 1:
        for i in range(p[0]+1):
            point = 100 * d
            if i == p[0]:
                point += c[0]
            res.append([point,i])
            if point >= g:
                break
    else:
        for lelse in min_plobrem(p[1:],c[1:]):
            for i in range(p[0]+1):
                point = 100 * (d-len(p)+1) * i
                if i == p[0]:
                    point += c[0]
                res.append([lelse[0]+point, lelse[1]+i])
                if point >= g:
                    break
    return(res)

results = min_plobrem(p,c)
for result in results:
    if result[0] >= g:
        minp = min(minp, result[1])

print(minp)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
grid = [[0,0]]#インデックス合わせとく
for i in range(D):
    p,c = map(int, input().split())
    grid.append([p,c])

import itertools
kumi = list(itertools.product([0,1], repeat=D))
anls = []
fans = float('inf')
for item in kumi:
    count = 0
    ans = 0
    k = 0
    score = 0
    for i in item:
        count += 1
        if i == 1:
            score += grid[count][0]*100*count + grid[count][1]
            ans += grid[count][0]
        else:
            k = count

    if G <= score and ans != 0:
        fans = min(fans,ans)
    elif score+(k*100)*(grid[k][0]-1) >= G and ans !=0:
        ans += (G-score)/(k*100)
        fans = min(fans,ans)
if fans != float('inf'):
    fans = int(fans)
print(fans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split())
grid = [[0,0]]#インデックス合わせとく
for i in range(D):
    p,c = map(int, input().split())
    grid.append([p,c])

import itertools
kumi = list(itertools.product([0,1], repeat=D))
anls = []
fans = float('inf')
for item in kumi:
    count = 0
    ans = 0
    k = 0
    score = 0
    for i in item:
        count += 1
        if i == 1:
            score += grid[count][0]*100*count + grid[count][1]
            ans += grid[count][0]
        else:
            k = count

    if G <= score:
        fans = min(fans,ans)
    elif score+(k*100)*(grid[k][0]-1) >= G:
        ans += (G-score)/(k*100)
        fans = min(fans,ans)
if fans != float('inf'):
    fans = int(fans)
print(fans)

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

complete = []
for i in range(2 ** d):
    temp = [0] * d
    for j in range(d):
        if (i >> j) & 1:
            temp[j] = 1
    complete.append(temp)

ans = 10 ** 9
for i in range(len(complete)):
    score = g
    solved = 0
    for j in range(d):
        zenkan = complete[i][j]
        num = pc[j][0]
        bonus = pc[j][1]
        point = (j + 1) * 100
        if zenkan == 1:
            solved += num
            score -= num * point + bonus

    if score < 0:
        ans = min(ans, solved)
    else:
        for j in reversed(range(d)):
            zenkan = complete[i][j]
            num = pc[j][0]
            bonus = pc[j][1]
            point = (j + 1) * 100
            if zenkan == 0:
                if score - (num - 1) * point > 0:
                    solved += num - 1
                    score -= (num - 1) * point
                else:
                    if score % point == 0:
                        solved += score // point
                    else:
                        solved += score // point + 1
                    ans = min(ans, solved)
                    break

print(ans)

Submission status: Wrong Answer

Solution code:
D, G = map(int, input().split()) 
S = [[int(x) for x in input().split()]for i in range(D)]
Minimum_can = []
for i in range(2**D):
    binary = str(format(i,'b'))
    binary_zero = binary.zfill(D)
    SUM = 0
    Number = 0
    for j in range(D):
        if binary_zero[j]=='1':
            SUM += S[j][0]*100*(j+1)+S[j][1]
            Number += S[j][0]
    if SUM == G: Minimum_can.append(Number)        
    elif SUM < G:
        Biggest_0_number = 0
        for k in range(D):
            if binary_zero[D-k-1]=='0':
                Biggest_0_number = D-k-1
                break
        for k in range(S[Biggest_0_number][0]):
            if SUM+100*(Biggest_0_number+1)*(k+1) >= G:
                Minimum_can.append(Number+k+1)
                break 
print(min(Minimum_can))

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = float('inf')
def dfs(i, sum, count, residue):
  global ans
  if i == d:
    if sum < g:
      use = max(residue)
      n = min(pc[use - 1][0], (g - sum)//(use*100))
      count += n
      sum +=  n*use*100
    if sum >= g:
      ans = min(ans, count)
  else:
    dfs(i + 1, sum, count, residue)
    dfs(i + 1, sum + pc[i][0]*(i + 1)*100 + pc[i][1], count + pc[i][0], residue - {i+1})

dfs(0, 0, 0, set(range(1, d+1)))
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = []
def dfs(i, sum, count, residue):
  if i == d:
    if sum < g:
      use = max(residue)
      n = min(pc[use - 1][0], (g - sum)//(use*100))
      count += n
      sum +=  n*use*100
    if sum >= g:
      ans.append(min(count, float('inf')))
  else:
    dfs(i + 1, sum, count, residue)
    dfs(i + 1, sum + pc[i][0]*(i + 1)*100 + pc[i][1], count + pc[i][0], residue - {i+1})
    
dfs(0, 0, 0, set(range(1, d+1)))
print(min(ans))

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = []
def dfs(i, sum, count, residue):
  if i == d:
    if sum < g:
      use = max(residue)
      n = min(pc[use - 1][0], (g - sum)//(use*100))
      count += n
      sum +=  n*use*100
    if sum >= g:
      ans.append(count)
  else:
    dfs(i + 1, sum, count, residue)
    dfs(i + 1, sum + pc[i][0]*(i + 1)*100 + pc[i][1], count + pc[i][0], residue - {i+1})
    
dfs(0, 0, 0, set(range(1, d+1)))
print(min(ans))

Submission status: Wrong Answer

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    D,G = readInts()
    P = []
    C = []
    res = float('inf')
    for i in range(D):
        p,c = readInts()
        P.append(p)
        C.append(c)
    # bit全探索
    for bit in range(1 << D):
        SUM = 0
        NUM = 0
        for i in range(D):
            if bit & (1 << i):
                SUM += P[i]*(1+i)*100 + C[i]
                NUM += P[i]
        if SUM >= G:
            res = min(res,NUM)
        else:
            for i in range(D):
                if bit & (1 << i):
                    continue
                else:
                    for j in range(P[i]):
                        if SUM >= G:
                            break
                        SUM += 100*(i+1)
                        NUM += 1
            res = min(res,NUM)
    print(res)
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import numpy as np
d, g = map(int, input().split())
p = []
c = []
for _ in range(d):
    a, b = map(int, input().split())
    p.append(a)
    c.append(b)
p = np.array(p)
p_sum = np.cumsum(p)
total = p_sum[-1]
p_sum = np.concatenate([[0], p_sum[:-1]])
q_solved = total

for i in np.arange(2 ** total):
    score = 0
    for j, (k, l, m) in enumerate(zip(p, p_sum, c)):
        num_q = 0
        for bit in range(l, l + k):
            if i & (1 << bit):
                score += 100 * (j + 1)
                num_q += 1

        if num_q == k:
            score += m

    if score >= g:
        q_solved = min(q_solved, bin(i).count('1'))

print(q_solved)

Submission status: Wrong Answer

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

ans_list = []

for i, pc in enumerate(PC):
  if 100*(i+1)*pc[0]+pc[1]>=g:
    ans_list.append(pc[0])

counter = 0    
    
while PC and g>0:
  pc = PC.pop(-1)
  for _ in range(1, pc[0]+1):
    counter += 1
    g -= d*100
    if g<=0:
      break
  
  g -= pc[1]
  d -= 1
  
ans_list.append(counter)

print(min(ans_list))

Submission status: Wrong Answer

Solution code:
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
print(pc)
ans = float("inf")
# 解いていない問題の配点をrestとして保持しておく。
# iは解いた問題の種類(配点/100)
# countは解いた問題の数
def dfs(i,sum,count,rest):
    # global変数としてansを引継ぎ
    global ans
    if i == d:
        # 合計がgoalを超えていなければrestに残っている問題の中で最大の得点の問題を解いていく。
        if sum < g:
            use = max(rest)
            n = min(pc[use-1][0], -(-(g-sum)//(use*100)))
            count += n
            sum += n*use * 100
            
        # 合計値が与えられた得点を超えていたら，最小の問題数を答える。
        if sum >= g:
            ans = min(ans, count)
            
    else:
        # 総合スコア，解いた問題数，まだ解いていない問題を更新する。
        # i得点の問題を解かないで次に進める場合
        dfs(i + 1, sum, count, rest)
        # i得点の問題を解いて先に進める場合，得点と問題数を加え，restからその得点要素を消去
        dfs(i + 1, sum + pc[i][0] * (i+1) * 100 + pc[i][1], count + pc[i][0], rest - {i+1})


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

# 関数内で定義したグローバル変数を出力する
print(ans)

Submission status: Wrong Answer

Solution code:
inf = 10**18
mod = 10**9+7
n, k = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(n)]
pc.reverse()
ans = inf
for i in range(2**n):
    acc=0
    accn=0
    for j in range(n):
        if ((i >> j) & 1):  # 1だったら(オンだったら)
            p,c = pc[j]
            acc+=((n-j)*100*p+c)
            accn+=p
            if acc>=k:
                ans=min(ans, accn)
    if k-acc >= 0:
        for j in range(n):
            if not ((i >> j) & 1):  # 0だったら(おふだったら)
                p, c = pc[j]
                if k - acc >= ((n - j) *100* (p - 1)):
                    acc += ((n - j) *100* (p - 1))
                    accn += (p - 1)
                else:
                    tmp = (k-acc+(n-j)*100-1)//((n-j)*100)
                    acc += ((n - j) *100* tmp)
                    accn += tmp
                    ans = min(ans, accn)
                    break
print(ans)

Submission status: Wrong Answer

Solution code:
inf = 10**18
mod = 10**9+7
n, k = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(n)]
pc.reverse()
ans = inf
for i in range(n**2):
    acc=0
    accn=0
    for j in range(n):
        if ((i >> j) & 1):  # 1だったら(オンだったら)
            p,c = pc[j]
            acc+=((n-j)*100*p+c)
            accn+=p
            if acc>=k:
                ans=min(ans, accn)
    if k-acc >= 0:
        for j in range(n):
            if not ((i >> j) & 1):  # 0だったら(おふだったら)
                p, c = pc[j]
                if k - acc > ((n - j) *100* (p - 1)):
                    acc += ((n - j) *100* (p - 1))
                    accn += (p - 1)
                else:
                    tmp = (k-acc+(n-j)*100-1)//((n-j)*100)
                    acc += ((n - j) *100* tmp)
                    accn += tmp
                    ans = min(ans, accn)
                    break
print(ans)

Submission status: Wrong Answer

Solution code:
inf = 10**15
mod = 10**9+7
n, k = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(n)]
pc.reverse()
ans = inf
for i in range(n**2):
    acc=0
    accn=0
    stop=False
    for j in range(n):
        if ((i >> j) & 1):  # 1だったら(オンだったら)
            p,c = pc[j]
            acc+=((n-j)*100*p+c)
            accn+=p
            if acc>=k:
                ans=min(ans, accn)
                stop=True
    if not stop:
        for j in range(n):
            if not ((i >> j) & 1):  # 0だったら(おふだったら)
                p, c = pc[j]
                if k - acc > ((n - j) *100* (p - 1)):
                    acc += ((n - j) *100* (p - 1))
                    accn += (p - 1)
                else:
                    tmp = (k-acc+(n-j)*100-1)//((n-j)*100)
                    acc += ((n - j) *100* tmp)
                    accn += tmp
                    ans = min(ans, accn)
                    break
print(ans)

Submission status: Wrong Answer

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

ans = float('inf')
pd = {}
for i in range(d):
  p, c = map(int,input().split())
  pd[i] = (p,c)
  
for i in range(d):
  for j in range(2**(d)):
    index = [(1<<k&j)>>k for k in range(d)]
    if index[i]==1:
      continue
    score = sum([index[k]*(pd[k][0]*(k+1)*100 + pd[k][1]) for k in range(d)])
    count = sum([index[k]*pd[k][0] for k in range(d)])
    if score < g:
      add_c = math.ceil((g-score) / ((i+1)*100))
      add_c = min(add_c, pd[i][0]-1)
      if add_c * (i+1)* 100 + score < g:
        continue
      else:
        count += add_c
    ans = min(ans, count)
print(ans)

Submission status: Wrong Answer

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

ans = float('inf')
pd = {}
for i in range(d):
  p, c = map(int,input().split())
  pd[i] = (p,c)
  
for i in range(d):
  for j in range(2**(d)):
    index = [(1<<k&j)>>k for k in range(d)]
    if index[i]==1:
      continue
    score = sum([index[k]*(pd[k][0]*(k+1)*100 + pd[k][1]) for k in range(d)])
    count = sum([index[k]*pd[k][0] for k in range(d)])
    if score < g:
      add_c = math.ceil((g-score) / ((i+1)*100))
      add_c = min(add_c, pd[i][0])
      if add_c * (i+1)* 100 + score < g:
        continue
      else:
        count += add_c
    ans = min(ans, count)
print(ans)

Submission status: Wrong Answer

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

print(pc)
ans = float("inf")

for i in range(2**D):
    sum = 0
    count = 0
    rem = set(range(1,D+1))
    for j in range(D):
        if (i >> j) & 1:
            sum += pc[j][0]*100*(j+1)+pc[j][1]
            count += pc[j][0]
            rem.discard(j+1)
    if sum < G:
        k = max(rem)-1
        n = min(pc[k][0],-(-(G-sum)//((k+1)*100)))
        count += n
        sum += n*100*(k+1)
    if sum >= G:
        ans = min(ans,count)

print(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)*100, p, c])
    
pc.reverse()
ans = 0
for i in range(d):
    #print(g, pc[i])
    s = pc[i][0] * pc[i][1] + pc[i][2]
    if g > s:
        ans += pc[i][1]
        g -= s
    else:
        if g > s - pc[i][2]:
            ans += pc[i][1]
            break
        else:
            if g % pc[i][0] == 0:
                ans += g // pc[i][0]
            else:
                ans += g // pc[i][0] + 1

            break

print(ans)

Submission status: Wrong Answer

Solution code:
d,g = map(int,input().split())
P,C=[],[]
ans = 10**9
for i in range(d):
  p,c = map(int,input().split())
  P.append(p)
  C.append(c)

for i in range(2**d):
  score,solved_num,max_unsolve = 0,0,0
  for j in range(d):
    if i>>j&1:
      point = (j+1)*100
      simple_sum = point * P[j]
      add_bonus_sum = simple_sum + C[j]
      score += add_bonus_sum
      solved_num += P[j]
    else:
      max_unsolve = max(max_unsolve, j)
  if score >= g:
    ans = min(ans, solved_num)
  else:
    dif = abs(g-score)
    max_unsolve_point = (max_unsolve+1)*100
    nece_num = (dif+max_unsolve_point-1)//max_unsolve_point
    ans = min(ans, solved_num+nece_num)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys


def main():
    input = sys.stdin.readline
    D, G = map(int, input().split())
    scores = [list(map(int, input().split())) for i in range(D)]
    score_sum = 0
    count = 0

    for i in range(len(scores)-1, -1, -1):
        for j in range(scores[i][0]):
            if score_sum >= G:
              print(count)
              return;
            score_sum += 100*(i+1)
            count += 1
    
        score_sum += scores[i][1]
    


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys


def main():
    input = sys.stdin.readline
    D, G = map(int, input().split())
    scores = [list(map(int, input().split())) for i in range(D)]
    score_sum = 0
    count = 0

    for i in range(len(scores)-1, -1, -1):
        for j in range(scores[i][0]):
            if score_sum >= G:
              print(count)
              break;
            score_sum += 100*(i+1)
            count += 1
    
        score_sum += scores[i][1]
    


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import itertools

def solve(D, G, problems):
    bit_list = list(itertools.product([0, 1], repeat=D))
    
    result_count = 10 ** 8
    for pattern in bit_list:
        scores = 0 # スコアの合計
        count = 0  # 解いた問題数
        for i in range(D):
            if pattern[i] == 1: # ビット値が１の難易度の問題は全て解く
                scores += problems[i][0] * (i+1) * 100 + problems[i][1]  # 問題のスコア + ボーナス点
                count += problems[i][0]
            
            else:
                max_score_problem = i + 1
    
        # 合計スコアが足りない場合，もっともスコアの高い未着手の問題を必要な分だけ解く
        if G > scores:
            count += (G - scores) // (max_score_problem * 100)
            if  (G - scores) % (max_score_problem * 100) != 0:
                count += 1
                
        result_count = min(result_count, count)
            
    print(result_count)
    

if __name__ == '__main__':
    D, G = map(int, input().split())
    problems = [list(map(int, input().split())) for _ in range(D)]
    solve(D, G, problems)

Submission status: Wrong Answer

Solution code:
import itertools

def solve(D, G, problems):
    bit_list = list(itertools.product([0, 1], repeat=D))
    
    result_count = 10 ** 8
    for pattern in bit_list:
        scores = 0 # スコアの合計
        count = 0  # 解いた問題数
        for i in range(D):
            if pattern[i] == 1: # ビット値が１の難易度の問題は全て解く
                scores += problems[i][0] * (i+1) * 100 + problems[i][1]  # 問題のスコア + ボーナス点
                count += problems[i][0]
            
            else:
                max_score_problem = i + 1
    
        # 合計スコアが足りない場合，もっともスコアの高い未着手の問題を必要な分だけ解く
        if G > scores:
            count += (G - scores) // (max_score_problem * 100)
            if  (G - scores) % (max_score_problem * 100) != 0:
                count += 1
                
        result_count = min(result_count, count)
            
        print(result_count)
    

if __name__ == '__main__':
    D, G = map(int, input().split())
    problems = [list(map(int, input().split())) for _ in range(D)]
    solve(D, G, problems)