Problem: 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?

Submission attempts (in order):
D, G = map(int, input().split())
PC = [list(map(int,input().split())) for i in range(D)]

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append([c,int(i),t-G])
    
ct = 0
l2 = []
b = min(l)
for j in range(D):
  ct = 0
  if ((b[1] >> j) & 1):
    if b[2] <= PC[j][1]+(j+1)*100:
      b[2] -= PC[j][1]+(j+1)*100
      ct += 1
      while b[2] > (j+1)*100:
        b[2] -= (j+1)*100
        ct += 1
    l2.append(ct)
    
print(b[0]-max(l2))


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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    while t < G:
      t += (max(ck)+1)*100
      c += 1
    l.append(c)
      
print(c)


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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
      for k in range(PC[j][0]):
        t += (max(ck)+1)*100
        c += 1
        if t >= G:
          l.append(c)
      
print(min(l))


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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append([c,i,t-G])
    
b = min(l)
p = 0
for j in range(D):
  if ((b[1] >> j) & 1):
    if b[2] < PC[j][1]+(j+1)*100:
      b[2] -= PC[j][1]+(j+1)*100
      ct = 1
      while b[2] > [j +1]:
        b[2] -= (j+1)*100
        ct += 1
    
print(b[0]-ct)


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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]
  
PC1.sort(reverse=True)
accum = 0
ans = 0
for i in range(D):
  dm = PC1.index(max(PC1[min(i+1,D):],key=(lambda x: x[2])))
  if G - accum < (PC1[dm][1]-1) * PC1[dm][2]:
    for j in range(PC1[dm][1]):
      accum += PC1[dm][2]
      ans += 1
      if accum >= G:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)
          

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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]

count = 0
for j in range(D):
  count += PC[j][0]
  
PC1.sort()
accum = 0
ans = 0
for i in range(count):
  if G - accum < D * (PC[D-1][0]-1)
    for j in range(PC[D-1][0]-1)
    accum += D*100
    ans += 1
    if accum >= F:
      print(ans)
      exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)
          


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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    while t < G:
      t += (max(ck)+1)*100
      c += 1
    l.append(c)
      
print(min(l))


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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]
  
PC1.sort()
accum = 0
ans = 0
for i in range(D):
  dm = PC1.index(max(PC1[min(i+1,D):],key=(lambda x: x[2])))
  if G - accum < (PC1[dm][1]-1) * PC1[dm][2]:
    for j in range(PC1[dm][1]):
      accum += PC1[dm][2]
      ans += 1
      if accum >= G:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)
          


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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]

count = 0
for j in range(D):
  count += PC[j][0]
  
PC1.sort()
accum = 0
ans = 0
for i in range(count):
  if G - accum < D * (PC[D-1][0]-1)
    for j in range(PC[D-1][0]-1):
      accum += D*100
      ans += 1
      if accum >= F:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)
          


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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append([c,int(i),t-G])
    
ct = 0
b = min(l)
for j in range(D):
  if ((b[1] >> j) & 1):
    if b[2] <= PC[j][1]+(j+1)*100:
      b[2] -= PC[j][1]+(j+1)*100
      ct += 1
      while b[2] > (j+1)*100:
        b[2] -= (j+1)*100
        ct += 1
    
print(b[0]-ct)


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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    for k in range(PC[j][0]):
      t += (max(ck)+1)*100
      c += 1
      if t >= G:
        l.append(c)
      
print(min(l))


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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    ckm = max(ck)
    for k in range(PC[ckm][0]):
      t += (ckm+1)*100
      c += 1
      if t >= G:
        l.append(c)
        break
      
print(min(l))


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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = [((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1]]
  
PC1.sort()
accum = 0
ans = 0
for i in range(D):
  dm = PC1.index(max(PC1[min(i+1,D):],key=(lambda x: x[2])))
  if G - accum < PC1[dm][1] * PC1[dm][0]:
    for j in range(PC1[dm][1]):
      accum += PC1[dm][2]
      ans += 1
      if accum >= G:
        print(ans)
        exit()
  else:
    for j in range(PC1[i][1]):
      accum += PC1[i][2]
      ans += 1
      if j == PC1[i][1]-1:
        accum += PC1[i][3]
      if accum >= G:
        print(ans)
        exit()
print(ans)
          


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

PC1 = [[0,0,0,0]]*D
for i in range(D):
  PC1[i] = list(((i+1)*100*PC[i][0]+PC[i][1])/PC[i][0], PC[i][0], (i+1)*100, PC[i][1])

count = 0
for j in range(D):
  count += PC[j][0]
  
PC1.sort()
accum = 0
ans = 0
for i in range(count):
  for j in range(PC1[i][1]):
    accum += PC1[i][2]
    ans += 1
    if j = PC1[i][1]-1:
      accum += PC1[i][3]
    if accum >= G:
      print(ans)
      exit()
print(ans)
          
    
  
  

   



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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)

print(min(c))


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

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 1):
        continue
      else:
        ck.append(j)
    if ck == []:
      continue
    ckm = max(ck)
    for k in range(PC[ckm][0]):
      t += (ckm+1)*100
      c += 1
      if t >= G:
        l.append(c)
        break
      
print(min(l))


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted