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

p = []
c = []
ans = []
cnt = 0
ss = 0
for _ in range(d):
    pp, cc = map(int, input().split())

    p.append(pp)
    c.append(cc)



for x in range(2**d):
    ss = 0
    cnt = 0
    for i in range(d):
        if (x>>i)&1:

            ss += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    print("a",ss)
    if ss>=g:
        ans.append(cnt)

    else:
        print("c")
        for l in range(d)[::-1]:
            print(l)
            print(x>>l)
            if  ((x >> l) & 1):
                continue

            for _ in range(p[l]):
                ss += (l+1)*100
                print("b",ss)
                cnt += 1

                if ss>=g:
                    ans.append(cnt)
                    break

print(min(ans))














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

p = []
c = []
ans = []
cnt = 0
ss = 0
for _ in range(d):
    pp, cc = map(int, input().split())

    p.append(pp)
    c.append(cc)



for x in range(2**d):
    ss = 0
    cnt = 0
    for i in range(d):
        if (x>>i)&1:

            ss += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    print("a",ss)
    if ss>=g:
        ans.append(cnt)

    else:
        print("c")
        for l in range(d)[::-1]:
            print(l)
            print(x>>l)
            if  ((x >> l) & 1):
                continue

            for _ in range(1,p[l]):
                ss += (l+1)*100
                print("b",ss)
                cnt += 1

                if ss>=g:
                    ans.append(cnt)
                    break

print(min(ans))














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

p = []
c = []
ans = []
cnt = 0
ss = 0
for _ in range(d):
    pp, cc = map(int, input().split())

    p.append(pp)
    c.append(cc)



for x in range(2**d):
    ss = 0
    cnt = 0
    for i in range(d):
        if (x>>i)&1:

            ss += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    print("a",ss)
    if ss>=g:
        ans.append(cnt)

    else:
        print("c")
        for l in range(d)[::-1]:
            print(l)
            print(x>>l)
            if  ((x >> l) & 1):
                continue

            for _ in range(1,p[l]):
                ss += (l+1)*100
                print("b",ss)
                cnt += 1

                if ss>=g:
                    ans.append(cnt)
                    break

print(min(ans))














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

p = []
c = []
ans = []
cnt = 0
ss = 0
for _ in range(d):
    pp, cc = map(int, input().split())

    p.append(pp)
    c.append(cc)



for x in range(2**d):
    ss = 0
    cnt = 0
    for i in range(d):
        if (x>>i)&1:

            ss += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    print("a",ss)
    if ss>=g:
        ans.append(cnt)

    else:
        print("c")
        for l in range(d)[::-1]:
            print(l)
            print(x>>l)
            if  ((x >> l) & 1):
                continue

            for _ in range(1,p[l]):
                ss += (l+1)*100
                print("b",ss)
                cnt += 1

                if ss>=g:
                    ans.append(cnt)
                    break

print(min(ans))














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

p = []
c = []
ans = []
cnt = 0
ss = 0
for _ in range(d):
    pp, cc = map(int, input().split())

    p.append(pp)
    c.append(cc)

for i,pp in enumerate(list(reversed(p))[::-1]):
    for _ in range(1,pp):
        ss += (len(p)-i+1)*100
        cnt += 1
        if ss>=g:
            ans.append(cnt)


for x in range(2**d):
    ss = 0
    cnt = 0
    for i in range(d):
        if (x>>i)&1:

            ss += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    print("a",ss)
    if ss>=g:
        ans.append(cnt)

    else:
        print("c")
        for l in range(d)[::-1]:
            print(l)
            print(x>>l)
            if not ((x >> l) & 1):

                for _ in range(1,p[l]):
                    ss += (l+1)*100
                    print("b",ss)
                    cnt += 1

                    if ss>=g:
                        ans.append(cnt)
                        break

print(min(ans))














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

p = []
c = []
ans = []
cnt = 0
ss = 0
for _ in range(d):
    pp, cc = map(int, input().split())

    p.append(pp)
    c.append(cc)



for x in range(2**d):
    ss = 0
    cnt = 0
    for i in range(d):
        if (x>>i)&1:

            ss += (i+1)*100*p[i] + c[i]
            cnt += p[i]
    if ss>=g:
        ans.append(cnt)

    else:
        for l in range(d)[::-1]:
            if  ((x >> l) & 1):
                continue

            for _ in range(1,p[l]):
                ss += (l+1)*100
                cnt += 1

                if ss>=g:
                    ans.append(cnt)
                    break

print(min(ans))














Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted