Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #4433569

Source Code Expand

Copy
```import math
D,G = map(int,input().split())
L = []
for i in range(D):
L.append(list(map(int,input().split())))
n = 2
ans = float('inf')
def Base_10_to_n(X, n):
if (int(X/n)):
return Base_10_to_n(int(X/n),n)+str(X%n)
return str(X%n)
for i in range(2**D):
K = Base_10_to_n(i, n).zfill(D)
S = 0
sub = 0
for j in range(D):
if K[j] == '1':
S += L[j][0]*100*(j+1)+L[j][1]
sub += L[j][0]
if S >= G:
if sub <= ans:
ans = sub
else:
cnt = 0
for l in range(D):
if cnt == 0:
if K[D-l-1] == '0':
cnt = 1
if G-S <= L[D-l-1][0]*100*(D-l)+L[D-l-1][1]:
if G-S > L[D-l-1][0]*100*(D-l):
if ans >= sub+L[D-l-1][0]:
ans = sub+L[D-l-1][0]
else:
if ans >= sub+math.ceil((G-S)/(100*(D-l))):
ans = sub+math.ceil((G-S)/(100*(D-l)))
print(ans)```

#### Submission Info

Submission Time 2019-03-02 23:23:11+0900 C - All Green Syuko4omi Python (3.4.3) 300 928 Byte AC 29 ms 3064 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
 AC × 4
 AC × 24
Set Name Test Cases
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
Case Name Status Exec Time Memory
a01 20 ms 3064 KB
a02 18 ms 3064 KB
a03 18 ms 3064 KB
a04 18 ms 3064 KB
b05 18 ms 3064 KB
b06 29 ms 3064 KB
b07 28 ms 3064 KB
b08 18 ms 3064 KB
b09 18 ms 3064 KB
b10 18 ms 3064 KB
b11 19 ms 3064 KB
b12 21 ms 3064 KB
b13 23 ms 3064 KB
b14 28 ms 3064 KB
b15 29 ms 3064 KB
b16 29 ms 3064 KB
b17 28 ms 3064 KB
b18 28 ms 3064 KB
b19 28 ms 3064 KB
b20 20 ms 3064 KB
b21 23 ms 3064 KB
b22 28 ms 3064 KB
b23 28 ms 3064 KB
b24 28 ms 3064 KB