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:
P=[]
C=[]
point=1001    #全問題数

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

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                  #1問も解かなかった問題の中で最も一題あたりの点が高い問題
            needproblem=j+1
    if score>=G :
        point=min(point,solve)

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想

    elif score<G :                
        needsolve=(G-score)//(needproblem*100)
        if needsolve>=P[needproblem-1] :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
            continue
        elif needsolve<P[needproblem-1] :
            resolve=solve+needsolve
            point=min(point,resolve)

print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1001    #全問題数

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

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                  #1問も解かなかった問題の中で最も一題あたりの点が高い問題
            needproblem=j+1
    if score>=G :
        point=min(point,solve)

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想

    elif score<G :                
        needsolve=(G-score)//(needproblem*100)
        if needsolve>P[needproblem-1] :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
            continue
        elif needsolve<P[needproblem-1] :
            resolve=solve+needsolve
            point=min(point,resolve)

print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1001    #全問題数

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

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                  #1問も解かなかった問題の中で最も一題あたりの点が高い問題
            needproblem=j+1
    if score>=G :
        point=min(point,solve)

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想

    elif score<G :                
        needsolve=(G-score)//(needproblem*100)
        if needsolve>P[needproblem-1] :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
            continue
        elif needsolve<=P[needproblem-1] :
            resolve=solve+needsolve
            point=min(point,resolve)

print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1000    #全問題数

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

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                  #1問も解かなかった問題の中で最も一題あたりの点が高い問題
            needproblem=j+1
    if score>=G :
        point=min(point,solve)

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想

    elif score<G :                
        needsolve=(G-score)//(needproblem*100)
        if needsolve>P[needproblem-1] :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
            continue
        elif needsolve<=P[needproblem-1] :
            resolve=solve+needsolve
            point=min(point,resolve)

print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1000    #全問題数

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

#とりあえず全部解くor解かないで目標スコアを超えるか超えないかを考える


for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :                  #全正解した大問をスコアに変換
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                  #1問も解かなかった問題の中で最も一題あたりの点が高い問題
            needproblem=j+1
        point=min(point,solve)

#ぎりぎりスコアが届いていない場合、1問も解かなかった問題の中で最も一題あたりの点が高い問題だけ解いてみる
#中途半端に大問を解ききるのが１種類以下でも目標に届く場合もあるという予想

    if score<G :                
      needsolve=(G-score)//(needproblem*100)
      if needsolve>P[needproblem-1] :            #1問も解かなかった問題の中で最も一題あたりの点が高い問題を解いても届かないのでやり直し
          continue
      elif needsolve<=P[needproblem-1] :
          resolve=solve+needsolve
          point=min(point,resolve)

print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1000 
D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)
 
for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :            
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                
            needproblem=j+1
            
    if score>=G :
        point=min(point,solve)
        continue
    elif score<G :                
        needsolve=(G-score)//(needproblem*100)
        if needsolve>P[needproblem-1] :  
            continue
        elif needsolve<=P[needproblem-1] :
            resolve=solve+needsolve
            point=min(point,resolve)
print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1000 
D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)
 
for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :            
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                
            needproblem=j+1
            
    if score>=G :
        if solve>D*100 :
            continue
        point=min(point,solve)
    elif score<G :                
        needsolve=(G-score)//(needproblem*100)
        if needsolve>P[needproblem-1] :  
            continue
        elif needsolve<=P[needproblem-1] :
            resolve=solve+needsolve
            point=min(point,resolve)
print(point)

Submission status: Wrong Answer

Solution code:
P=[]
C=[]
point=1000 
D,G=map(int,input().split())
for i in range(D):
    p,c= map(int,input().split())
    P.append(p)
    C.append(c)
 
for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :            
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                
            needproblem=j+1
            
    if score>=G :
        point=min(point,solve)
    elif score<G :                
        needsolve=((G-score)//(needproblem*100))+1
        if needsolve>P[needproblem-1] :  
            continue
        elif needsolve<=P[needproblem-1] :
            resolve=solve+needsolve
            point=min(point,resolve)
print(point)

Submission status: Wrong Answer

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

for i in range(2**D) :
    score=0
    solve=0
    needproblem=0
    for j in range(D) :            
        if (i>>j) & 1 :
            score+=P[j]*100*(j+1)+C[j]
            solve+=P[j]
        if (~i>>j) & 1 :                
            needproblem=j+1
            
    if score>=G :
        point=min(point,solve)
    elif score<G :                
        needsolve=(G-score)//(needproblem*100)
        if needsolve>P[needproblem-1] :  
            continue
        elif needsolve<=P[needproblem-1] :
            resolve=solve+needsolve
            point=min(point,resolve)
print(point)

Submission status: Wrong Answer

Solution code:
import sys
import copy
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    D, G = in_nn()
    p = [0] * D
    c = [0] * D
    for i in range(D):
        a, b = in_nn()
        p[i] = a
        c[i] = b

    now_p = copy.copy(p)

    def calc_score():
        ret = 0
        for i in range(D):
            if now_p[i] == p[i]:
                ret += c[i] + 100 * (i + 1) * now_p[i]
            else:
                ret += 100 * (i + 1) * now_p[i]
        return ret

    while True:
        score = []
        for i in range(D):
            if now_p[i] > 0:
                if now_p[i] == p[i]:
                    s = c[i] + 100 * (i + 1)
                else:
                    s = 100 * (i + 1)
                score.append((s, i))
        score.sort()

        if calc_score() > G:
            now_p[score[0][1]] -= 1
        else:
            break

    print(sum(now_p))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def dfs(i, sum, count, unsolve):
 global ans
 if i == D:
  #G点に満たなければunsolveのうち最も大きいものを解く
  if sum < G:
   use = max(unsolve)
  #解く問題が問題数を超えないようにする
   N = min(pc[use-1][0], -(-(G-sum)//(100*use)))
   count += N 
   sum += N * 100 * use
  if sum > G:
   ans = min(ans, count)
 else:
  dfs(i + 1, sum, count, unsolve)
  dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], unsolve - {i + 1})
 
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(D)]
ans = float("inf")
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 = 100000000
for bit in range(1 << D):
    s = 0
    ans_ = 0
    li = 0
    for i in range(D):
        if bit & (1 << i):
            s += (i+1) * 100 * pc[i][0] + pc[i][1] 
            ans_ += pc[i][0]
        else:
          li = i  
    if s < G:
        lv = 100 * (li + 1)
        need = int((G - s) / lv + 0.5)
        if pc[li][0] < need:
            continue
        ans_ += need
    ans = min(ans, ans_)

print(int(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 = 1e10
for bit in range(1 << D):
    s = 0
    ans_ = 0
    li = 0
    for i in range(D):
        if bit & (1 << i):
            s += (i+1) * 100 * pc[i][0] + pc[i][1] 
            ans_ += pc[i][0]
        else:
          li = i  
    if s < G:
        lv = 100 * (li + 1)
        need = int((G - s) / lv + 0.5)
        if pc[li][0] < need:
            continue
        ans_ += need
    ans = min(ans, ans_)

print(int(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 = 1e10
for bit in range(1 << D):
    s = 0
    ans_ = 0
    li = 0
    for i in range(D):
        if bit & (1 << i):
            s += (i+1) * 100 * pc[i][0] + pc[i][1] 
            ans_ += pc[i][0]
        else:
          li = i  
    if s < G:
        lv = 100 * (li + 1)
        need = (G - s) / lv
        if pc[li][0] < need:
            continue
        ans_ += need
    ans = min(ans, ans_)

print(int(ans))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
D, G = map(int, input().split(' '))
p_c_pairs = [((i+1) * 100, list(map(int, input().split(' ')))) for i in range(D)]

import math
ans = float('inf')
p_c_pairs.sort(key=lambda x: -x[0])
for d in range((D+1)**2):
    # print(bin(d))

    cnt = 0
    g = G
    for i in range(D):
        if 1 & (d >> i):
            score, (p, c) = p_c_pairs[i]
            g -= score * p + c
            cnt += p

    if g > 0:
        for i in range(D):
            if not (1 & (d >> i)):
                score, (p, c) = p_c_pairs[i]
                n = min(p, int(math.ceil(g/score)))
                g -= score * n
                cnt += n
                break

    # print(bin(d), g)
    if g <= 0:
        ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
D, G = map(int, input().split(' '))
p_c_pairs = [((i+1) * 100, list(map(int, input().split(' ')))) for i in range(D)]

import math
ans = float('inf')
p_c_pairs.sort(key=lambda x: -x[0])
for d in range((D+1)**2):
    print(bin(d))

    cnt = 0
    g = G
    for i in range(D):
        if 1 & (d >> i):
            score, (p, c) = p_c_pairs[i]
            g -= score * p + c
            cnt += p

    if g > 0:
        for i in range(D):
            if not (1 & (d >> i)):
                score, (p, c) = p_c_pairs[i]
                n = min(p, int(math.ceil(g/score)))
                g -= score * n
                cnt += n
                break

    # print(bin(d), g)
    if g <= 0:
        ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
D, G = map(int, input().split(' '))
p_c_pairs = [((i+1) * 100, list(map(int, input().split(' ')))) for i in range(D)]

import math
ans = float('inf')
p_c_pairs.sort(key=lambda x: -x[0])
for d in range(D**2):
    cnt = 0
    g = G
    for i in range(D):
        if 1 & (d >> i):
            score, (p, c) = p_c_pairs[i]
            g -= score * p + c
            cnt += p

    if g > 0:
        for i in range(D):
            if not (1 & (d >> i)):
                score, (p, c) = p_c_pairs[i]
                n = min(p, int(math.ceil(g/score)))
                g -= score * n
                cnt += n
                break

    # print(bin(d), g)
    if g <= 0:
        ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
D, G = map(int, input().split(' '))
p_c_pairs = [((i+1) * 100, list(map(int, input().split(' ')))) for i in range(D)]

ans = float('inf')
p_c_pairs.sort(key=lambda x: -x[0])
for d in range(D**2):
    cnt = 0
    g = G
    for i in range(D):
        if 1 & (d >> i):
            score, (p, c) = p_c_pairs[i]
            n = min(p, g // score)
            cnt += n

            g -= score * n
            if n == p:
                g -= c

    # print(bin(d), g)
    if g <= 0:
        ans = min(ans, cnt)

print(ans)

Submission status: Wrong Answer

Solution code:
D,G=map(int,input().split())
oe=[]
for i in range(D):
  p,c=map(int,input().split())
  oe.append([(c+p*100*(i+1))/p,p,c,i+1])
oe.sort(reverse=True)
ans=0
co=0
for i in range(D):
  for j in range(oe[i][1]):
    co+=1
    ans+=100*oe[i][3]
    if j==oe[i][1]-1:
      ans+=oe[i][2]
    if G<=ans:
      print(co)
      exit()

Submission status: Wrong Answer

Solution code:
from itertools import product
from math import ceil
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = 10**9
for bit in product([0, 1], repeat=d):
    score = 0
    probs = 0
    for i, b in enumerate(bit):
        p, c = pc[i]
        if b==1:
            probs+=p
            score+=100*(i+1)*p
            score+=c
    if score >= g:
        ans = min(ans, probs)
    else:
        # greedyに足す
        for i, b in list(enumerate(bit))[::-1]:
            p, c = pc[i]
            if b==1:
                continue
            if score+100*(i+1)*p >= g:
                probs += ceil((g-score)/(100*(i+1)))
                break
            else:
                probs += p
                score += (100*(i+1))*p
        if score >= g:
            ans = min(ans, probs)
            break
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product
from math import ceil
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = 10*9
for bit in product([0, 1], repeat=d):
    score = 0
    probs = 0
    for i, b in enumerate(bit):
        p, c = pc[i]
        if b==1:
            probs+=p
            score+=100*(i+1)*p
            score+=c
    if score >= g:
        ans = min(ans, probs)
    else:
        # greedyに足す
        for i, b in list(enumerate(bit))[::-1]:
            p, c = pc[i]
            if b==1:
                continue
            if score+100*(i+1)*p >= g:
                probs += ceil((g-score)/(100*(i+1)))
                ans = min(ans, probs)
                break
            else:
                probs += p
                score += (100*(i+1))*p
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = 10*9
for bit in product([0, 1], repeat=d):
    score = 0
    probs = 0
    for i, b in enumerate(bit):
        p, c = pc[i]
        if b==1:
            probs+=p
            score+=100*(i+1)*p
            score+=c
    if score >= g:
        ans = min(ans, probs)
    else:
        # greedyに足す
        for i, b in list(enumerate(bit))[::-1]:
            p, c = pc[i]
            if b==1:
                continue
            if score+100*(i+1)*p >= g:
                probs += (g-score)//(100*(i+1))
                ans = min(ans, probs)
                break
            else:
                probs += p
                score += (100*(i+1))*p
print(ans)

Submission status: Wrong Answer

Solution code:
import bisect


def main():
  D, G = list(map(int, input().split()))
  P = []
  for i in range(1, D+1):
    P.append(tuple(map(int, input().split())))

  # print(D, G, P)
  minp = float('inf')
  for bit in range(1 << D):
    total = 0
    num_p = 0
    bset = set()
    for i in range(D):
      mask = 1 << i
      if bit & mask:
        total += P[i][1] + 100*(i+1)*P[i][0]
        num_p += P[i][0]
        bset.add(i)

    # print(f'bset:{bset}, num_p:{num_p}')

    res = G - total
    if res <= 0:
      if num_p < minp:
        minp = num_p
      continue

    for i in reversed(sorted(set([i for i in range(D)]) - bset)):
      maxv = 100*(i+1) * (P[i][0]-1)

      if res <= maxv:
        num_take = min(bisect.bisect(list(range(0, maxv+100*(i+1), 100*(i+1))), res)-1, P[i][0]-1)
        # print(list(range(0, maxv, 100*(i+1))))
        # print(f'res:{res} so solve {i+1} * {num_take}')
        num_p += num_take
        res -= 100*(i+1)*num_take
        if num_p < minp:
          minp = num_p
        break

      res -= maxv
      # print(f'solve {i+1} * {P[i][0]-1}')
      num_p += (P[i][0]-1)

  print(minp)


if(__name__ == '__main__'):
  main()

Submission status: Wrong Answer

Solution code:
import bisect


def main():
  D, G = list(map(int, input().split()))
  P = []
  for i in range(1, D+1):
    P.append(tuple(map(int, input().split())))

  # print(D, G, P)
  minp = float('inf')
  for bit in range(1 << D):
    total = 0
    num_p = 0
    bset = set()
    for i in range(D):
      mask = 1 << i
      if bit & mask:
        total += P[i][1] + 100*(i+1)*P[i][0]
        num_p += P[i][0]
        bset.add(i)

    # print(f'bset:{bset}, num_p:{num_p}')

    res = G - total
    if res <= 0:
      if num_p < minp:
        minp = num_p
      continue

    for i in reversed(sorted(set([i for i in range(D)]) - bset)):
      maxv = 100*(i+1) * (P[i][0]-1)

      if res <= maxv:
        num_take = bisect.bisect(list(range(0, maxv+100*(i+1), 100*(i+1))), res) - 1
        # print(list(range(0, maxv, 100*(i+1))))
        # print(f'res:{res} so solve {i+1} * {num_take}')
        num_p += num_take
        res -= 100*(i+1)*num_take
        if num_p < minp:
          minp = num_p
        break

      res -= maxv
      # print(f'solve {i+1} * {P[i][0]-1}')
      num_p += (P[i][0]-1)

  print(minp)


if(__name__ == '__main__'):
  main()

Submission status: Wrong Answer

Solution code:
#! env python
# -*- coding: utf-8 -*-

from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime

# atcoder.main
# Date: 2020/06/20
# Filename: main 
# Author: acto_mini

sys.setrecursionlimit(10 ** 8)
INF = float('inf')

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

for bit in range(1 << D):
    count = 0
    sum = 0
    left_over = set(range(1, D + 1))

    for i in range(D):
        if bit & (1 << i):
            sum += PC[i][0] * (i + 1) * 100 + PC[i][1]
            count += PC[i][0]
            left_over.discard(i + 1)

    if sum < G:
        use = max(left_over)
        n = min(PC[use - 1][0], -((G - sum) // (use * 100)))
        count += n
        sum += n * use * 100

    if sum >= G:
        ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
#! env python
# -*- coding: utf-8 -*-

from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime

# atcoder.main
# Date: 2020/06/20
# Filename: main 
# Author: acto_mini

sys.setrecursionlimit(10 ** 8)
INF = float('inf')

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

for bit in range(1 << D):
    count = 0
    sum = 0
    left_over = set(range(1, D + 1))

    for i in range(D):
        if bit & (1 << i):
            sum += PC[i][0] * (i + 1) * 100 + PC[i][1]
            count += PC[i][0]
            left_over.discard(i + 1)

    if sum < G:
        use = max(left_over)
        n = min(PC[use - 1][0], (G - sum) // (use * 100))
        count += n
        sum += n * use * 100

    if sum >= G:
        ans = min(ans, count)

print(ans)

Submission status: Wrong Answer

Solution code:
def solve(bit):
    ret = 0
    score = 0
    done = set()
    for i in range(D):
        if bit[i]:
            done.add(i)
            ret += L[i][0]
            score += ((i + 1) * 100) * L[i][0] + L[i][1]
    j = D - 1
    cnt = 0
    while score < G:
        while j in done:
            j -= 1
        ret += 1
        cnt += 1
        score += (j + 1) * 100
        if cnt == L[j][0]:
            done.add(j)
            score += L[j][1]
            cnt = 0
    return ret

D, G = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(D)]
ans = float('inf')
for i in range(D << 1):
    bit = [0] * D
    for j in range(D):
        if i >> j & 1:
            bit[j] = 1
    ans = min(ans, solve(bit))
print(ans)

Submission status: Wrong Answer

Solution code:
def solve(bit):
    ret = 0
    score = 0
    done = set()
    for i in range(D - 1):
        if bit[i] == 1:
            done.add(i)
            ret += L[i][0]
            score += ((i + 1) * 100) * L[i][0] + L[i][1]
    j = D - 1
    cnt = 0
    while score < G:
        while j in done:
            j -= 1
        ret += 1
        cnt += 1
        score += (j + 1) * 100
        if cnt == L[j][0]:
            score += L[j][1]
            cnt = 0
            done.add(j)
    return ret

D, G = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(D)]
ans = float('inf')
for i in range(D << 1):
    bit = [0] * D
    for j in range(D):
        if i >> j & 1:
            bit[j] = 1
    ans = min(ans, solve(bit))
print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
    # ABC 104 C - All Green(my answer for bit)
    D, G = map(int, input().split())
    p, c = [], []
    ans = float('inf')
    for _ in range(D):
        a, b = map(int, input().split())
        p.append(a)
        c.append(b)

    for bit in range(1 << D):  # bitで完答した問題を列挙
        score = 0
        cnt = 0
        comp = set(range(D))
        for i in range(D):  # 完答した問題のscoreを全て加算
            if bit & (1 << i):
                score += p[i] * 100 * (i + 1) + c[i]
                cnt += p[i]
                comp.discard(i)
        if score < G:  # scoreがGに満たなければ中途半端に解答する
            incomp = max(comp)
            incomp_num = min(p[incomp],
                             ((G - score) // (100 * (incomp + 1))))
            score += (incomp + 1) * incomp_num * 100
            cnt += incomp_num
        if score >= G:  # scoreが目標点G以上なら計算回数cntを記録
            ans = min(ans, cnt)
    print(ans)


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
# ABC 104 C - All Green

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

for i in range(1 << sum(p)):  # bitで各問題を正解したかを区別
    score = 0
    for j in range(D):  # 得点scoreを計算
        cnt = 0
        for k in range(p[j]):
            if i & (1 << k):
                score += 100 * (j+1)
                cnt += 1
        if cnt == p[j]:
            score += c[j]
    if score == G:
        print(bin(i).count('1'))
        break

Submission status: Wrong Answer

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


def dfs(i, sum, count, nokori):
    global ans
    if i == d:#全ての最後の問題セットにたどり着いたら,　全ての葉を確認
        if sum < g:
            use = max(nokori)#選んでいない種類で最大のスコアの問題を選ぶ
            n = min(pc[use-1][0], (g-sum)//(use*100))#その難易度の問題の数 または 残りの必要スコア/その難易度の問題1問の点数　の最小値をとる->余計に問題を解かない＆問題数を超えてとかない
            count += n
            sum += n * use * 100

        if sum >= g:#全ての葉の達成してる最小の答えを記録
            ans = min(ans, count)

    else:
        dfs(i+1, sum, count, nokori)#選ばなかった場合
        dfs(i+1, sum + pc[i][0] * (i+1) * 100 + pc[i][1], count + pc[i][0], nokori - {i+1})#全て解いた番号をセットから抜いて、合計&countを更新

ans = float("inf")
dfs(0, 0, 0, set(range(1, d+1)))
print(ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())

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

ans = 1000000000000000
for i in range(2 ** n):
    check = 0
    ac = 0
    tmp = 0
    for j in range(n):
        if (i >> j) & 1:
            check += a[j][0] * 100 * (j + 1) + a[j][1]
            tmp += a[j][0]
        
        if check >= m:
            ans = min(ans, tmp)

        else:
            for k in reversed(range(n)):
                if not (i >> k) & 1:
                    ac = (m - check) // ((k + 1) * 100)
                    if ac < a[k][0]:
                        ans = min(ans, ac + tmp)

print(ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())

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

b = []
for i in range(n):
    b += [100 * (i + 1) for j in range(a[i][0])]

d = []
ans = 1000000000000000
for i in range(2 ** n):
    check = 0
    tmp = 5000000
    c = []
    counter = {}
    for j in range(n):
        if (i >> j) & 1:
            check += a[j][0] * 100 * (j + 1) + a[j][1]
            tmp = a[j][0]
        
        if check >= m:
            ans = min(ans, tmp)
        
        else:
            for k in range(n - 1, 0, -1):
                if (i >> k) & 0:
                    ac = (m - check) // (k + 1) * 100
                    if ac > a[k][0]:
                        ans = min(ans, ac + tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
d, g = [int(i) for i in input().split()]
table = [[int(i) for i in input().split()] for j in range(d)]

total = 1000
for i in range(2**d):
    comp = []
    temp = 0
    temp2 = 0
    temp3 = 0
    for j in range(d):
        if(i >> j & 1):
            comp.append(1)
            temp += table[j][1] + table[j][0] * 100 * (j + 1)
            temp2 += table[j][0]
        else:
            comp.append(0)
            temp3 = j
    if(temp + table[temp3][0] * 100 * (temp3 + 1) >= g):
        temp2 += max(0, (g - temp) // ((temp3 + 1) * 100))
        total = min(total, temp2)

print(total)

Submission status: Wrong Answer

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

pc2 = [((p*100*(i+1)+c)/p, i, p, c, ((p*100*(i+1)+c)))
       for (i, (p, c)) in enumerate(pc)]

pc2.reverse()

rest = g
ans = 0

while rest > 0:
    # print(pc2)
    if pc2[0][4] <= rest:
        rest -= pc2[0][4]
        ans += pc2[0][2]
        del pc2[0]
    else:
        prob = 10**30
        point = 0
        for _, i, p, c, _ in pc2:
            x = 100*(i+1)
            num = (rest+x-1)//x
            if num * p >= point and prob > num:
                prob = num
                point = num*p
        ans += prob
        rest -= point
        break


# print(rest)

print(ans)