結果

問題 No.37 遊園地のアトラクション
ユーザー irisAshirisAsh
提出日時 2019-06-02 18:12:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,476 ms / 5,000 ms
コード長 552 bytes
コンパイル時間 134 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 63,744 KB
最終ジャッジ日時 2024-04-18 20:10:15
合計ジャッジ時間 10,129 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 167 ms
13,184 KB
testcase_01 AC 31 ms
11,008 KB
testcase_02 AC 205 ms
16,000 KB
testcase_03 AC 296 ms
21,504 KB
testcase_04 AC 129 ms
12,672 KB
testcase_05 AC 211 ms
14,208 KB
testcase_06 AC 182 ms
16,384 KB
testcase_07 AC 980 ms
45,056 KB
testcase_08 AC 110 ms
14,080 KB
testcase_09 AC 55 ms
11,904 KB
testcase_10 AC 732 ms
34,944 KB
testcase_11 AC 703 ms
37,248 KB
testcase_12 AC 196 ms
16,384 KB
testcase_13 AC 267 ms
20,352 KB
testcase_14 AC 123 ms
14,592 KB
testcase_15 AC 146 ms
13,184 KB
testcase_16 AC 413 ms
25,216 KB
testcase_17 AC 344 ms
23,424 KB
testcase_18 AC 916 ms
42,368 KB
testcase_19 AC 49 ms
11,776 KB
testcase_20 AC 322 ms
20,480 KB
testcase_21 AC 138 ms
15,104 KB
testcase_22 AC 1,476 ms
63,744 KB
testcase_23 AC 27 ms
11,008 KB
testcase_24 AC 26 ms
11,008 KB
testcase_25 AC 30 ms
11,136 KB
testcase_26 AC 29 ms
11,008 KB
testcase_27 AC 170 ms
14,464 KB
testcase_28 AC 27 ms
10,880 KB
testcase_29 AC 103 ms
12,672 KB
testcase_30 AC 26 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
T=int(input())
N=int(input())
C=list(map(int,input().split()))
V=list(map(int,input().split()))
Z=list(zip(C,V))
Z2=Z[:]
for z in Z:
    c=z[0]
    v=z[1]
    while True:
        v=math.floor(v/2)
        if v<=0:
            break
        Z2.append((c,v))
A=[[0]*(T+1) for i in range(len(Z2)+1)]
for i in range(1,len(Z2)+1):
    for t in range(1,T+1):
        z=Z2[i-1]
        c=z[0]
        v=z[1]
        if t-c<0:
            A[i][t]=A[i-1][t]
        else:
            A[i][t]=max(A[i-1][t-c]+v,A[i-1][t])
print(max(list(map(max,A))))
0