結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
13,056 KB
testcase_01 AC 35 ms
11,008 KB
testcase_02 AC 224 ms
16,000 KB
testcase_03 AC 335 ms
21,504 KB
testcase_04 AC 139 ms
12,544 KB
testcase_05 AC 218 ms
14,208 KB
testcase_06 AC 189 ms
16,384 KB
testcase_07 AC 1,043 ms
44,928 KB
testcase_08 AC 124 ms
14,336 KB
testcase_09 AC 55 ms
11,776 KB
testcase_10 AC 800 ms
34,944 KB
testcase_11 AC 774 ms
37,248 KB
testcase_12 AC 216 ms
16,512 KB
testcase_13 AC 302 ms
20,224 KB
testcase_14 AC 136 ms
14,720 KB
testcase_15 AC 160 ms
13,056 KB
testcase_16 AC 450 ms
25,088 KB
testcase_17 AC 379 ms
23,424 KB
testcase_18 AC 1,055 ms
42,368 KB
testcase_19 AC 52 ms
11,776 KB
testcase_20 AC 339 ms
20,608 KB
testcase_21 AC 144 ms
15,232 KB
testcase_22 AC 1,413 ms
63,872 KB
testcase_23 AC 30 ms
11,008 KB
testcase_24 AC 29 ms
10,880 KB
testcase_25 AC 29 ms
11,008 KB
testcase_26 AC 28 ms
11,008 KB
testcase_27 AC 180 ms
14,336 KB
testcase_28 AC 31 ms
10,880 KB
testcase_29 AC 114 ms
12,672 KB
testcase_30 AC 29 ms
10,880 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[:]
O=0
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])
    O=max(max(A[i]),O)
print(O)
0