提出 #22250380


ソースコード 拡げる

D,G = map(int,input().split())
L = [[0] * 2 for i in range(D)]
for i in range(D):
    L[i][0],L[i][1] = map(int,input().split())

ans = float('inf')
for i in range(2 ** D):
    score = 0#解いた点数
    anser = 0#解いた数
    use = []#どれを使用したか
    for j in range(D): 
        if ((i >> j) & 1): 
            anser+=L[j][0]
            score+=L[j][1]+(j+1)*100*L[j][0]
            use.append(j)
    if (G <= score):
        #G以上のため、現在の内容でチェック
        ans = min(ans,anser)
    else:
        #Gを超えていないため、解いてない中で高い問題から解いてG以上になったらチェック
        for i in reversed(range(D)):
            if not i in use:
                for j in range(L[i][0]):
                    if score < G:
                        score+=(i+1)*100
                        anser+=1
        ans = min(ans,anser)
print(ans)

提出情報

提出日時
問題 C - All Green
ユーザ H20
言語 PyPy3 (7.3.0)
得点 300
コード長 941 Byte
結果 AC
実行時間 83 ms
メモリ 68416 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 4
AC × 24
セット名 テストケース
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
ケース名 結果 実行時間 メモリ
a01 AC 67 ms 61928 KiB
a02 AC 52 ms 61672 KiB
a03 AC 51 ms 61768 KiB
a04 AC 53 ms 63904 KiB
b05 AC 50 ms 61956 KiB
b06 AC 82 ms 68416 KiB
b07 AC 61 ms 68104 KiB
b08 AC 54 ms 61676 KiB
b09 AC 53 ms 61884 KiB
b10 AC 50 ms 63344 KiB
b11 AC 51 ms 63768 KiB
b12 AC 68 ms 68064 KiB
b13 AC 70 ms 68196 KiB
b14 AC 78 ms 68280 KiB
b15 AC 74 ms 68280 KiB
b16 AC 83 ms 68160 KiB
b17 AC 74 ms 68260 KiB
b18 AC 71 ms 68100 KiB
b19 AC 71 ms 68052 KiB
b20 AC 65 ms 67852 KiB
b21 AC 72 ms 68220 KiB
b22 AC 73 ms 68044 KiB
b23 AC 72 ms 68388 KiB
b24 AC 78 ms 68396 KiB